TSQL : Find non a-z, A-Z, "-" caracters in a column

Hi !

I need to find a way to query my SQL 2008 database to find all caracters that are not a-z, A-Z and "-" in the column named "address".

The database collation is : Latin1_General_CI_AS

I've try to do "SELECT address FROM users where address LIKE '%é%' but this was not effective.

-M
Rubicon2009Asked:
Who is Participating?
 
sshah254Connect With a Mentor Commented:
Use this example to check it out - http://stackoverflow.com/questions/150977/perform-regex-replace-in-an-sql-query

Essentially the loop should run for each character and replace it with "".  At the end you'll be left with all non alphabetic characters.

If these are US addresses, then there would be an efficient way of parsing the data string.

Ss
0
 
cojdevCommented:
Is this what you are looking for?

SELECT address FROM users where address LIKE '%[^A-Za-z]%'

The ^ is like Not

This might work;
SELECT address FROM users where address NOT LIKE '%[A-Za-z]%'
0
 
Guy Hengel [angelIII / a3]Connect With a Mentor Billing EngineerCommented:
close:


SELECT address FROM users where address LIKE '%^[A-Za-z]%'
0
 
SharathConnect With a Mentor Data EngineerCommented:
Do you want to extract all characters other than a-z, A-Z and "-" from address field or do you want a filter condition to filter the address column to exclude these values?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.