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
 SQL Server 2008 Forums
 Transact-SQL (2008)
 select only lower case data in a column

Author  Topic 

jfriedl
Starting Member

4 Posts

Posted - 2011-10-21 : 15:04:31
one of our jr dba's accidently ran a SSIS package that created tons of duplicate email addresses in our ERP system. normally we would just revert to backup but no one caught the error and this was done months ago apparently.

Basically in my table I have

0000005 1 JML test@test.com NULL
and
0000005 2 JML test@TEST.COM Y


where the first column is my primary key and the second column lists the position of the email in the form that its listed on.

I need to remove the lower case duplicates but Im completely stumped on how to do this.

the database collation is Latin1_General_BIN

any ideas?

Sachin.Nand

2937 Posts

Posted - 2011-10-21 : 15:35:38
How about this ?


Select * from your table where lower(email)=email collate Latin1_General_CS_AS


This will return all the emails which are in lower case.

PBUH

Go to Top of Page

jfriedl
Starting Member

4 Posts

Posted - 2011-10-21 : 15:52:55
quote:
Originally posted by Sachin.Nand

How about this ?


Select * from your table where lower(email)=email collate Latin1_General_CS_AS


This will return all the emails which are in lower case.

PBUH


This helps me narrow it down, thanks!


Go to Top of Page
   

- Advertisement -