ASA SQL Reference
SQL Functions
Alphabetical list of functions
Returns the position of one string in another.
CHARINDEX ( string-expression1, string-expression2 )
string expression1 The string you are searching for.
string expression2 The string to be searched.
The position of the first character in the string being searched is 1.
If the string being searched contains more than one instance of the other string, then CHARINDEX returns the position of the first instance.
If the string being searched does not contain the other string, then CHARINDEX returns 0.
SQL/92 Vendor extension.
SQL/99 Vendor extension.
Sybase Compatible with Adaptive Server Enterprise.
The statement
SELECT emp_lname, emp_fname FROM employee WHERE CHARINDEX('K', emp_lname ) = 1
returns the following values:
emp_lname | emp_fname |
---|---|
Klobucher | James |
Kuo | Felicia |
Kelly | Moira |