Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

SQL Server 2005 Remove Dups - CTE

By Tom Huneke,

No more selecting DISTINCT into a temp table and then inserting back into the cleaned out table. This does it all for you in two statements.

Deleting from the CTE actually changes the underlying table. Be careful how you setup your CTE. You could have some unintended deletes without the right logic.

Total article views: 6901 | Views in the last 30 days: 4
 
 
Contribute