CHARINDEX
Searches an expression for another expression and returns its starting position if found.
Syntax
CHARINDEX ( expressionToFind , expressionToSearch [ , start_location ] )
Arguments
expressionToFind
Is a character expression that contains the sequence to be found. expressionToFind is limited to 8000 characters.
expressionToSearch
Is a character expression to be searched.
start_location
Is an integer or bigint expression at which the search starts. If start_location is not specified, is a negative number, or is 0, the search starts at the beginning of expressionToSearch.
Return types
bigint if expressionToSearch is of the varchar(max), nvarchar(max), or varbinary(max) data types; otherwise, int.
Examples
SELECT CHARINDEX('123', '123 123 123', 10);