INSTR

The INSTR function returns the index of the first occurrence of a substring in a string.

Syntax

INSTR(str, substring)

str

The string in which to search for the substring.

substring

The substring to search for.

Results

Returns the index in str of the first occurrence of substring.

The first index is 1.

If substring is not found, INSTR returns 0.

Examples

splice> SELECT DisplayName, INSTR(DisplayName, 'Pa') "Position"
   FROM Players
   WHERE (INSTR(DisplayName, 'Pa') > 0)
   ORDER BY DisplayName;
DISPLAYNAME             |Position
------------------------------------
Alex Paramour           |6
Buddy Painter           |7
Jeremy Packman          |8
Pablo Bonjourno         |1
Paul Kaster             |1

5 rows selected

See Also