Please visit DEMANDDRAFT.SHOP for quality of products...

Ad

Search This Blog

Tuesday, July 17, 2012

PATINDEX Function in SQL Server

PATINDEX

As a contrast PatIndex is used to search a pattern within an expression. The Difference between CharIndex and PatIndex is the later allows WildCard Characters.

PATINDEX ( '%pattern%' , expression)


Here the first argument takes a pattern with wildcard characters like '%' (meaning any string) or '_' (meaning any character).

For Example
PATINDEX('%BC%','ABCD')

Output: 
 2

No comments:

Post a Comment