Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 10.0.1 » UltraLite - Database Management and Reference » UltraLite SQL Function Reference » Alphabetical list of functions

CHAR function [String] Next Page

CHARINDEX function [String]


Returns the position of one string in another.

Syntax

CHARINDEX( string-expression-1, string-expression-2 )

Parameters

string-expression-1    The string for which you are searching.

string-expression-2    The string to be searched.

Remarks

The first character of string-expression-1 is identified as 1. If the string being searched contains more than one instance of the other string, then the CHARINDEX function returns the position of the first instance.

If the string being searched does not contain the other string, then the CHARINDEX function returns 0.

See also
Standards and compatibility
Example

The following statement returns last and first names from the Surname and GivenName tables, but only when the last name includes the letter K:

SELECT Surname, GivenName
FROM Employees
WHERE CHARINDEX( 'K', Surname ) = 1 ;

Results returned:

Surname GivenName
Klobucher James
Kuo Felicia
Kelly Moira