Duplicate error

  • I am trying to insert values from source to destination and i ma getting the following error.What should be the solution to this???

    [Destination 13 - QuoteAdditionalPlan [1603]] 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 Native Client" Hresult: 0x80004005 Description: "The statement has been terminated.".

    An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Cannot insert duplicate key row in object 'dbo.BRASS_QuoteAdditionalPlan' with unique index 'NK_QuotelAdditionalPlan'. The duplicate key value is (628091, 101 CHARS, 1, 12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901, Life, R)."

  • The error message is quite clear.....please check the unique index constraint 'NK_QuotelAdditionalPlan' on your table. Basically some key value or values(if it happens to be a composite key) are coming withn the same value(s) as already present in the table.

    The solution is really about a paradigm followed in the ssis domain :

    Have a stage table where you bring in all your data and then insert/update in the actual destination table. The advantage in this pattern is that because the stg table usually does not have any primary keys / unique indexes etc and also generally all the datatypes are varchars, you don't encounter such issues as you are having.

    After data is in stg table, just insert / update the destinatin table based on a mismatch query with the stg table.

    Hope this helps.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply