Srinivas Srinivas - 3 months ago 6
SQL Question

How to Delete Duplicate records from Table in SQL Server?

How to Delete Duplicate records from Table in SQL Server ?

Answer
WITH CTE AS(
   SELECT [col1], [col2], [col3], [col4], [col5], [col6], [col7],
       RN = ROW_NUMBER()OVER(PARTITION BY col1 ORDER BY col1)
   FROM dbo.Table1
)
DELETE FROM CTE WHERE RN > 1

Example

Comments