Thank this author by sharing:
By Peter Petrov,
Here is another "deleting duplicate records" script, this time in-place. It exploits the ability to relatively easily add and drop a uniqueidentifier column to a table. The term "must-be-unique columns" refers to the set of columns that have to have a unique combination of values (natural primary key candidate for the table). The DELETE statement is quite generic and the comments suggest the changes needed for any other table. In addition, you obviously have to replace "MyTab" with the name of your table. Note: The "DELETE" statement is designed and formatted in order to extend its usage - replacing "DELETE t" with "SELECT t.*" will return the records that will be deleted.
delete duplicates from table with all columns with datatype varchar()
delete first 10rows from the table without knowing column names
Deletion of records
Many times we need to alter the table definition by adding , deleting or updating a column in the ta...
As a member of SQLServerCentral, you get free access to loads of fresh content: thousands
of articles and SQL scripts, a library of free eBooks, a weekly database news roundup,
a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals
that makes it such a success.