Subject | Cannot restore primary key after removing it |
---|---|
Author | |
Post date | 2013-11-22T17:27:40Z |
Hi, I am experiencing a problem when I try to restore a primary key constraint after removing it. I am removing it to speed up the import I am doing. (perhaps this does not speed things up so much ?) Anyways here is what it looks like in general:
ALTER TABLE CHARGE DROP CONSTRAINT PK_CHARGE
(commit)
insert alot of CHARGE records here (committing after every 500 inserts, and at the end)
ALTER TABLE CHARGE ADD CONSTRAINT PK_CHARGE PRIMARY KEY (CHARGE_TABLE_ID)
(commit )
This last statement executes, but fails on commit with this error:
Invalid insert or update value(s): object columns are constrained - no 2 table rows can have duplicate column values
Engine Code : 335544349
Engine Message :
attempt to store duplicate value (visible to active transactions) in unique index "PK_CHARGE"
I have run a query to determine if I have two records with the same primary key, and it appears that I do not. I have backed up and restored, and just try to restore the primary key, still no luck.
Any thoughts?