Yet Another Deleting Duplicate Records (in-place)

  • Peter Petrov

    Default port

    Points: 1465

    Comments posted to this topic are about the item Yet Another Deleting Duplicate Records (in-place)

  • odeddror

    SSC Eights!

    Points: 878

    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

  • Peter Petrov

    Default port

    Points: 1465

    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

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply