|Subject||Cannot restore primary key constraint after removing|
I am removing a primary key constraint in order to speed up an import of many records. After the import, I commit all changes, and then restore the primary key to my table with this:
ALTER TABLE CHARGE ADD CONSTRAINT PK_CHARGE PRIMARY KEY (CHARGE_TABLE_ID)
The statement executes OK, but
I receive this error message when it is being committed:
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 checked count on the primary key field, and there appears to be only one instance for each "CHARGE_TABLE_ID". I have backed up and restored the database, and then tried adding the constraint, but same error message.