Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Find All Special Characters in a SQL Server

Author  Topic 

manninb20
Starting Member

4 Posts

Posted - 2015-01-23 : 13:23:36
I would like to find all Special Characters in a table. I am currently using the code below. Not sure if this gets all of them.

select top 50 *
from [dbo].[SV20150122]
where street LIKE '%[^0-9a-zA-Z @\.\-]%'

waterduck
Aged Yak Warrior

982 Posts

Posted - 2015-01-26 : 03:49:34
declare @a table(col1 varchar(10))
insert into @a select
'a1' union all select
'a' union all select
'1' union all select
'a1*' union all select
'a*' union all select
'1*' union all select
'*'

select *, ASCII(col1) from @a
where col1 like '%[^0-Z]%'
Go to Top of Page
   

- Advertisement -