Tuesday, March 27, 2012

duplicate rows

What is the best way to remove duplicate rows from a table ?There were a couple of ways that I have tried worked. The first one is to use 'set rowcount 1' then delete the row with count(*) > 1. The second works better for large tables. Insert into TempTable select distinct * from RealTable. Delete all row with count(*) > 1, and then insert the temp table rows back to the real table.

Hope this helps. Good luck!

No comments:

Post a Comment