Step 1:
I create copy of table (with out data) in DB-B Table 1, PK on Col. a is enabled:
Step 2:
When I try to copy data from DB-A Table 1 to DB-B Table 1, the insert into DB-B Table 1 complains about uniqueness. As I have listed the values of Col. a (in DB-A), there ARE 2 rows with the value '1' - so it violates the uniqueness.
My questions was: So why is there duplicate data in Col. a DB-A when it has a PK on it ?
I thing the answer is: that it was probably created with 'novalidate' ???
It might happen also for THE ORDER OF THE CREATION OF CONSTRAINTS ,if u have other different constraints on the same object.
And this is the very common reason. Then we have to make disable required constraints and then revalidate that primary constraint and again reenable those disable constarint.
I think we faced the same problem. (refer to today's thread "How to find duplication key")
It could have people create the first table without enforcng the constraints, and later they changed their mind and put constraints in it. In my case, I disabled the primary key (cascade) and copy that original table to another data source, then enabled the primary key in the original table, so it will not harm the original table, while I get the copy of it successfully.
Hope it helps.
The trigger was inserting the insert time into the table on DB-B, and that is part of the PK...so....since that insert time was the same down to the seconds, it was making it non-unique:
Bookmarks