In T-SQL you may use “insert” to remove duplicates. What you must do is create another work table with the IGNORE_DUP_KEY option set.
So you copy the data from one table to the other. Drop the original table and rename the work table to your original table name and that's it. You will have a plain, clean, non duplicated records table. Something like:
CREATE TABLE tableCleanDup
(idfield int, field1 varchar(30), field2 varchar(30))
CREATE UNIQUE INDEX removeduplicates ON tableCleanDup (field1,field2) WITH IGNORE_DUP_KEY
GO
INSERT tableCleanDup SELECT * FROM tableOriginal
It will return to you a message “duplicate key was ignored” but that is fine. The tableCleanDup will have the records from tableOriginal but without duplicates.
p.s.: Thanks to Ken Henderson for this T-SQL advice.
Vers