Primary or Unique Key on table accepting bulk load

  • Newbe question. I want to establish a key(either primary or unique) on a table that will receive a bulk load that is the output of an ssis package. Will the key(s) prevent duplicate records from being added? Will the entire job fail if there are dups? given the bulk load operation should I use a unique key rather than a primary key?

  • rmatthias001 (2/7/2013)


    Newbe question. I want to establish a key(either primary or unique) on a table that will receive a bulk load that is the output of an ssis package. Will the key(s) prevent duplicate records from being added? Will the entire job fail if there are dups? given the bulk load operation should I use a unique key rather than a primary key?

    What would you like to happen, if you could choose? There is probably a way, whatever it is ...

    The absence of evidence is not evidence of absence.
    Martin Rees

    You can lead a horse to water, but a pencil must be lead.
    Stan Laurel

  • The key prevents duplicates. As to what fails in the load, the transaction with the dup fails. If that's the entire load, the entire load fails. You can commit in batches, however, and then only one batch would fail.

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

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