• That's awesome, turkbuku. I've use this construct (rank over blah0 with Oracle's rowid, but rowid is not available in SQL server. But this 'with' contruct works as well as rowid.

    Hot damn. Thank you, man.

    With a bit of cut and paste...

    drop table DupTable

    go

    create table DupTable (id int, col1 varchar(50))

    go

    insert into DupTable values(1,'some text')

    insert into DupTable values(1,'some text')

    insert into DupTable values(2,'some text2')

    insert into DupTable values(2,'some text2')

    -- the ID is a duplicate on the following row but the value of col1 is not...

    insert into DupTable values(2,'this is different but with the same id')

    insert into DupTable values(3,'some text3')

    insert into DupTable values(3,'some text3')

    insert into DupTable values(4,'some text4')

    GO

    SELECT * FROM duptable;

    with Dups as

    (SELECT *,row_number() OVER

    (partition by id order by id,col1) as RowNum

    FROM duptable)

    Delete from Dups where rownum > 1;

    SELECT * FROM duptable