The CHARINDEX function is often used to search for characters or strings in a word. Assuming that the character being searched includes a character to search for, the function returns a nonzero integer that is the start of the character to be searched in the character being searched. That is, the CHARINDEX function returns the starting position of a character or string in a string.
The CHARINDEX function calls methods such as the following:
CHARINDEX (expression1, expression2 [, Start_location])
Expression1 is the character to look for in expression2, Start_location is where the CHARINDEX function starts to find expression2 in expression1.
Example one:
Select CHARINDEX (' q1l ', ' Http://blog.csdn.net/jiankun ')
The results are as follows:
Example two:
Select CHARINDEX (' blog ', ' Http://blog.csdn.net/jiankun ')
The results are as follows:
SQL SERVER charindex functions