Search This Blog

Friday, February 4, 2011

Delete duplicate records in a table

A simple CTE to delete duplicate records;

;with wcte as (
Select Row_Number() OVER (partition By Column1 Order By Column1) as ROW ,Column1,Column2
from YourTable )
Delete from wcte where Row >= 2

No comments:

Post a Comment