SQL PATINDEX Function

Example

Return the position of a pattern in a string:

SELECT PATINDEX(‘%schools%’, ‘iampsp.com’);

Definition and Usage

The PATINDEX() function returns the position of a pattern in a string.

If the pattern is not found, this function returns 0.

Note: The search is case-insensitive and the first position in string is 1.

Syntax

PATINDEX(%pattern%, string)

Continue reading SQL PATINDEX Function