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


Add to briefcase

Yet Another Deleting Duplicate Records (in-place) Expand / Collapse
Author
Message
Posted Saturday, January 3, 2009 9:28 PM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Wednesday, October 8, 2014 7:50 PM
Points: 1,199, Visits: 349
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 Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: 2 days ago @ 7:27 PM
Points: 202, Visits: 292
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
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Wednesday, October 8, 2014 7:50 PM
Points: 1,199, Visits: 349
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 »

Add to briefcase

Permissions Expand / Collapse