Duplicate Primary key Issue in SSIS

  • I have 3 source for IS flow. One is flat file, one is DB table and one is output bad data. It might be a situation when I could have duplicate primary key since records come from 3 sources (flat file, db table, reject (output) table). Can any one give me suggestion how to handle duplicate primary key problem in this situation.

    Any suggestion will be appreciated.

    Thanks..

  • How are you merging the data from the sources? It's not clear to me if you have 2 or 3 sources? Is the reject a destination or a source?

    If the primary key is defined correctly then you do want to reject he second one and send it to the reject destination. I'm not sure what else you could do.

  • I think I have to rephrase my question. The question is I have 3 sources and based on requirements either data goes to destination table or output table (bad date). What if I all ready have a records in my destination which come again from any of my source ( specially from flat file, since I don't have any control on flat file source), What I have to do to handle this situation gracefully?. I don't want to reload same data, and I don't want to fail IS package because of primary key issue. I hope I explain my situation correctly.

    Thanks.

  • Okay, now I understand the issue better.

    You want to set the error output on your destination to either ignore error or redirect row, the issue is the that, what if you have another type of error that you do want to fail the package.

    Here is a link to an article[/url] I wrote on SSIS error handling and the code for it is in the discussion thread for the article. You could adapt it to fail on any error other than a constraint violation.

Viewing 4 posts - 1 through 3 (of 3 total)

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