Sql Server: Delete duplicate rows with CTE

Here’s a code snippet to remove duplicate rows in a table:

 WITH CTE (Column1, Column2, DuplicateCount)  
 AS  
 (  
 SELECT Column1,Column2,  
 ROW_NUMBER() OVER(PARTITION BY Column1,Column2 ORDER BY Column1) AS DuplicateCount  
 FROM TheTable  
 )  
 DELETE  
 FROM CTE  
 WHERE DuplicateCount > 1  
 GO  

More on Common Table Expressions(CTE) can be found here:

http://msdn.microsoft.com/en-us/library/ms190766(v=sql.105).aspx