In SQL server, the "PARTITION BY" clause is utilized to divide a result set into partitions depending on the values of one or more columns. This feature can be employed to eliminate duplicate values in a table.
WITH CTE AS
(
SELECT *,ROW_NUMBER() OVER (PARTITION BY Column_Name ORDER BY Column_Name ) AS RN
FROM Table_Name
)
DELETE FROM CTE WHERE RN<>1
Top comments (0)