Sorry, I don't understand what you want when you say "how can I escape".Maybe:declare @str varchar(100)select @str = 'san&%()v;+;'select PATINDEX('%[^a-z0-9 _]%',@str)this:select left(@str,(PATINDEX('%[^a-z0-9 _]%',@str))-1)or this:select substring(@str,0,(PATINDEX('%[^a-z0-9 _]%',@str)))
and I have not considered if there is a string without any character for patindex to find...Webfred
No, you're never too old to Yak'n'Roll if you're too young to die.