Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Delete duplicate records
Message
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
00596573
Message ID:
00596685
Views:
15
>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?

How about:

delete from table_name where pk_column in (select pk_column from
table_name group by pk_column having count(*)>1);


Works on Oracle but maybe the sql server syntax is different?

HTH
Previous
Reply
Map
View

Click here to load this message in the networking platform