Quick Ref.
Functions
date
number
string
Data Types
date
number
string
Compatibility
PATINDEX('%s1%', s2)
Engine OK Alternative
mysql no POSITION(s1 IN s2)
oracle no INSTR(s2,s1)
postgres no POSITION(s1 IN s2)
sqlserver yes

PATINDEX

PATINDEX('%s1%', s2) returns the character position of the substring s1 within the larger string s2. The first character is in position 1. If s1 does not occur in s2 it returns 0. The match is case insensitive.

 PATINDEX('%ll%' 'Hello world') -> 3 
In this example you return the position of the string 'an' within the name of each country.

Results
See also: