Gossamer Forum
Home : General : Databases and SQL :

Help - can't delete record

Quote Reply
Help - can't delete record
Somebody, with a name a lot like mine, managed to enter two records into a table with the same key ID (using Enterprise Manager for a SQL 2000 db).

Now I cannot delete either of the duplicate records. I get this error when I try to delete, or edit, the records:

"Key column information is insufficient or incorrect. Too many rows were affected by update."

I've checked my other tables, and there aren't any that I can find that depend on either of the particular records.

I'd rather not have to try to explain this to my db guy on Monday, so if you can tell me how to fix I'd be greatly appreciative! And I'll swear to never do it again. Tongue


Quote Reply
Re: [ArmyAirForces] Help - can't delete record In reply to
Yea, I've come across that before...Here are some suggestions:

1) If there are any differences in column values, you could use the WHERE clause to delete the other record.

2) Manually edit the key to another number.

3) There is a stored proc on the web somewhere that will allow you to re-increment your primary key column. May be able to find it at dbforums.com.

4) Export the records into a temp table with a total different Primary Key, then delete the old Primary Key column.

5) Restore your database from a backup.
Buh Bye!

Quote Reply
Re: [Stealth] Help - can't delete record In reply to
I ended up doing a variation on number 4.