CHARINDEX
- Last UpdatedDec 19, 2022
- 1 minute read
The function searches for a character expression (findWhat) within a second character expression (searchWhat) and returns the starting position of the first expression if found. If needed, you can specify the starting position (n) of the search within the second expression.
Syntax
Int32 CHARINDEX(findWhat AnsiString, searchWhat AnsiString)
Int32 CHARINDEX(findWhat String, searchWhat String)
Int32 CHARINDEX(findWhat AnsiString, searchWhat AnsiString, n Int32)
Int32 CHARINDEX(findWhat String, searchWhat String, n Int32)
Arguments
-
findWhat
The string to search for. Must be a character string or an expression resulting in a character string.
-
searchWhat
The string to search within. Must be a character string or an expression resulting in a character string.
-
n
Optional. Starting position for the search within the searchWhat string. If not specified, the search starts at the first character. Must be an integer.