Skip to content

Instantly share code, notes, and snippets.

@halityurttas
Created September 15, 2015 07:06
Show Gist options
  • Save halityurttas/cde2ff8d5d9a1984166a to your computer and use it in GitHub Desktop.
Save halityurttas/cde2ff8d5d9a1984166a to your computer and use it in GitHub Desktop.
T-SQL Delete Duplicate Rows
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment