Skip to content

Instantly share code, notes, and snippets.

@chaliy
Created June 8, 2010 09:31
Show Gist options
  • Save chaliy/429815 to your computer and use it in GitHub Desktop.
Save chaliy/429815 to your computer and use it in GitHub Desktop.
Solution to remove duples from SQL table
-- Stupid solution to remove duples from sql table...
DECLARE @temp TABLE
(
[Col1] [uniqueidentifier] NOT NULL,
[Col2] [uniqueidentifier] NOT NULL
)
INSERT INTO @temp
SELECT DISTINCT [Col1] ,[Col2]
FROM TargetTable
DELETE FROM TargetTable
INSERT INTO TargetTable SELECT * FROM @temp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment