DECLARE @myString varchar(500), @validChars varchar(100)
SELECT @myString = 'sA123-\[]{}',@validChars = 'a-z0-9'
While @myString like '%[^' + @validChars + ']%'
Select @myString = replace(@myString,substring(@myString,patindex('%[^' + @validChars + ']%',@myString),1),'')
SELECT @myString AS OutPutString
SELECT @myString = 'sA123-\[]{}',@validChars = 'a-z0-9'
While @myString like '%[^' + @validChars + ']%'
Select @myString = replace(@myString,substring(@myString,patindex('%[^' + @validChars + ']%',@myString),1),'')
SELECT @myString AS OutPutString
No comments:
Post a Comment