How to remove duplicate records from a table?
nancy joseph
Please refer the article Remove duplicate records/data from Sql Server database table http://www.webcodeexpert.com/2013/11/how-to-remove-duplicate-recordsdata.html
DELETE EMP_T FROM (SELECT ROW_NUMBER() OVER PARTATION BY (ID,NAME) ORDER BY ID) AS ROWID FROM EMP) EMP_TWHERE EMP_T.ROWID >1
/* Delete Duplicate records */ WITH CTE (COl1,Col2, DuplicateCount) AS ( SELECT COl1,Col2, ROW_NUMBER() OVER(PARTITION BY COl1,Col2 ORDER BY Col1) AS DuplicateCount FROM DuplicateRcordTable ) DELETE FROM CTE WHERE DuplicateCount > 1 GO