>I have a table from a client that never got a primary key put on the id field. There are 700 duplicate records where every field including id is duped. Is there any automatic way to rid these so that I can define a primary key on this id field? I know how to get a list of the dupes.
>
>Does adding an idx primary key field with seed 1 step 1 help?
Amendment: Sorry I did see this is SQL Server category. Never mind
First I would add a primary key field and valuate it for every record. Then the next 2 lines of SQL will do it:
SELECT * from TableX GROUP BY dupfield1, dupfield2, dupfield3 ;
INTO CURSOR crsUnique
DELETE FROM TableX WHERE PKField NOT in (select PKField FROM crsUnique)
Just do not GROUP BY your PK Field.
Mark McCasland
Midlothian, TX USA