In general, the fastest way to remove duplicates from a table is to insert records - without duplicates - into a temporary table, trim the original table and paste it back.
Here is an idea using SQL Server syntax:
select distinct t.* into
Of course, this largely depends on how fast the first step is. And you need to have a place to store two copies of the same table.
Note that the syntax for creating a temporary table is different from the database. Some use the create table as syntax rather than select into .
EDIT:
The error in entering the identification information is difficult. I think you need to remove the id from the list of columns for the individual. Or do:
select min(<identity col>), <all other columns> from t group by <all other columns>
If you have an identifier column, then there are no duplicates (by definition).
In the end, you will need to decide which identifier you want for the strings. If you can create a new identifier for the rows, just leave the identifier column from the list of columns to insert:
insert into t(<all other columns>) select <all other columns>;
If you need the old identifier value (and the minimum value will be done), disable insertion and do the following:
insert into t(<all columns including identity>) select <all columns including identity>;
source share