PATINDEX_UDF

Definition

This user-defined function (UDF) returns the starting position of the first occurrence of a pattern in a specified expression or zeros if the pattern is not found.

PATINDEX_UDF(PATTERN VARCHAR, EXPRESSION VARCHAR)

Parameters

PATTERN VARCHAR

The pattern to search for.

EXPRESSION VARCHAR

The expression that is being evaluated.

Returns

Returns an integer with the starting position of the pattern.

Usage example

Input:

SELECT PATINDEX_UDF('an', 'banana');

Output:

2

Last updated