Using PATINDEX for Regular Expressions in T-SQL
I recently needed to perform some validation using regular expressions in T-SQL rather than C#. Fortunately, this is easily accomplished using the PATINDEX keyword. For example:
The above example would check that the variable @Input does not begin with a numeric character.
PATINDEX('[^0-9]%',@Input)
The above example would check that the variable @Input does not begin with a numeric character.
Labels: Code Snippets, T-SQL
0 Comments:
Post a Comment
<< Home