2

How do i deal with this error in SSIS. I'm trying to load a data into an archive table. The package failed and came up with the below error message. I know that there are conflicting keys in the destination table that are being brought over from the source.

How do I deal with this? Any help will be appreciated. The data is about 30M records.

[OLE DB Destination [2]] Error: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005. An OLE DB record is available. Source: "Microsoft SQL Server Native Client 11.0" Hresult: 0x80004005 Description: "The statement has been terminated.". An OLE DB record is available. Source: "Microsoft SQL Server Native Client 11.0" Hresult: 0x80004005 Description: "Violation of PRIMARY KEY constraint 'PK_xxxxxx'. Cannot insert duplicate key in object 'dbo.mytable'.".

closed as off-topic by Jack Douglas Dec 24 '14 at 9:21

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Too localized - this could be because your code has a typo, basic error, or is not relevant to most of our audience. Consider revising your question so that it appeals to a broader audience. As it stands, the question is unlikely to help other users (regarding typo questions, see this meta question for background)." – Jack Douglas
If this question can be reworded to fit the rules in the help center, please edit the question.

0

If the primary key is a surrogate (ie an IDENTITY valued INT) then you need to remove it from the field list of the insert (if possible) otherwise (if you need to retain the surrogate key values to support foreign keys) to bracket the insert with set identity_insert on; and set identity_insert off;.

Not the answer you're looking for? Browse other questions tagged or ask your own question.