• Lowell - Wednesday, January 18, 2017 11:56 AM

    using row number is how i would find the dupes.
    the query i'm using here can be switced to a delete by simply swapping the commenting the --DELETE and commenting the SELECT *

    WITH cteDupes
    AS
    (
    SELECT row_number() OVER (Partition By SysGenHash ORDER BY ABCUniqueId) AS RW, *
    FROM [TableABC]
    )

    --DELETE 
    SELECT * 
    FROM cteDupes
    WHERE RW > 1

    Thanks!

    I should have mentioned that I have already followed Partition, to do the deletion of duplicates in Table ABC. I was using cursor for Requirement 2 but it is taking too much time. 

    Is there any quick/smart way to do Requirement 2?

    Thanks again!