Searching for Special Characters
Posted on 2003-11-11
I am trying to write a validation routine where I would use PATINDEX/CHARINDEX to locate either valid or invalid characters in a varchar variable. I am already checking for the presence of Upper Case characters, lower case characters, and numbers, but I am trying to locate special characters (by range, or group) without have to write a check for each special character individually.
e.g., IF PATINDEX('%[!,@,#,$,%...]%', @Variable)>0
Is this even possible? I thought that I had read somewhere that it was but just can't seem to locate it now.