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
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