If you are implementing a database and find that you have duplicate keys, you cannot create a primary key until you eliminate the duplicates. If you have a lot of patience, see Knowledgebase article Q139444. If you just want to clean out the duplicates, then run this script. It takes a table name as an argument and deletes all records with duplicate keys.

For SQL Server 6.5

Author: Tom De Lancey

Download Script:

We hope that the information on these script pages is
valuable to you. Your use of the information contained in these pages,
however, is at your sole risk. All information on these pages is provided
“as -is”, without any warranty, whether express or implied, of its accuracy,
completeness, or fitness for a particular purpose…

Disclaimer Continued

Back to Database Journal Home

Previous articlesp_removedevices.sql
Next articlesp_findcol.SQL

Latest Articles