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)
 Finding Partially Duplicate Data in Single Column

Author  Topic 

Kenznpunky
Starting Member

1 Post

Posted - 2015-03-16 : 12:12:45
Hello,

I am trying to find partially duplicated data in my customer column.

For example, I might have:


Customer
ABC School XXX
ABC School
XXX ABC School

These were put in incorrectly. There should only be one - ABC School. I have a query that strips out the XXX behind or XXX in front. But, I don't know how to get a list of what is in this query and then take that piece and look for it in the column (so, not having a literal value, but having it look for that columns value within the column).

Thanks for any help!!

stonebreaker
Yak Posting Veteran

92 Posts

Posted - 2015-04-06 : 14:38:24
How do you know that ABC School is the correct value? Do you have a list of correct values anywhere?

Stonebreaker
The greatest obstacle to discovery is not ignorance - it is the illusion of knowledge.
-Daniel Boorstin
Go to Top of Page

MichaelJSQL
Constraint Violating Yak Guru

252 Posts

Posted - 2015-04-06 : 15:04:44
If it is always just and XXX in the column along with the data you want.

UPDATE TABLE
SET COL= REPLACE(COL,'XXX','')

other than that you would need to specifically address what value to look for an what to change to as stonebreaker is saying
Go to Top of Page
   

- Advertisement -