SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On



Yet Another Deleting Duplicate Records (in-place) Expand / Collapse
Author
Message
Posted Saturday, January 03, 2009 9:28 PM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Wednesday, March 03, 2010 3:35 PM
Points: 969, Visits: 120
Comments posted to this topic are about the item Yet Another Deleting Duplicate Records (in-place)


Post #629418
Posted Wednesday, January 14, 2009 10:01 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Sunday, March 07, 2010 11:17 AM
Points: 189, Visits: 126
Peter,

You can do it with CTE like this

WITH x As (select row_number() over (partition by id1, id2 order by id2) nr FROM MyTab)
delete FROM x where nr > 1

Thanks,
Oded



Post #636820
Posted Thursday, January 15, 2009 1:19 PM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Wednesday, March 03, 2010 3:35 PM
Points: 969, Visits: 120
Thanks, Oded.

Unfortunately the CTE method does not work with SQL 2000. Last year I needed to cleanup hundreds tables in order to introduce primary keys, before 2000 - 2005 conversion and my method worked pretty well.

Regards,
Peter



Post #637540
« Prev Topic | Next Topic »


Permissions Expand / Collapse