Script Download:

This T-SQL script sample shows how to delete some duplicate rows in a table whose first 3 columns are the same and keep only one row. You can write a script according to your request by referencing this script.

Some people ask for a script to delete duplicate rows and keep only one row in a table. This T-SQL script sample will show you by creating a new table TestTable to imitate your table and a temporary table #TempTable. All the duplicate data will be stored in the temporary table. After executed, it will generate 2 tables, one to show you the duplicate data and a table to show the final result. 

image image

You can find more All-In-One Script Framework script samples at