Sql charindex is a sql server function that indicates the first position of a character or a character string within another character string. When a character or character string is found with sql charindex, the starting position is indicated with a non-zero positive integer value. If a character or character string is not found with charindex, a zero integer value is returned. charindex's starting position is 1, unlike other index search functions that would normally return 0 as the first position.
CHARINDEX ( expression1 ,expression2 [ , start_location ] )
- expression1
- Is an expression that contains the sequence of characters to be found. expression1 is an expression of the character string data type category.
- expression2
- Is an expression, typically a column searched for the specified sequence. expression2 is of the character string data type category.
- start_location
- Is the character position to start searching for expression1 in expression2. If start_location is not specified, is a negative number, or is zero, the search starts at the beginning of expression2. start_location can be of type bigint.
No comments:
Post a Comment