Use, CTEs, and ROW_NUMBER as the combination of these will allow you to see which rows are deleted (or updated), Thus change the DELETE FROM CTE... to SELECT * FROM CTE as follows:
QUERY:
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
For more information, you can refer to DEMO
COL1 COL2 COL3 COL4 COL5 COL6 COL7
john 1 1 1 1 1 1
sally 2 2 2 2 2 2
This example results in duplicates by a single column col1 because of the PARTITION BY col1.
If you have to include multiple columns, then simply add them to the PARTITION BY:
ROW_NUMBER () OVER(PARTITION BY Column1, Column2, ... ORDER BY OrderColumn)