How to prevnt duplicate PKs when using SqlBulkCopy

  • Thread starter Thread starter SteveB
  • Start date Start date
S

SteveB

Hi All,

I am using the SqlBulkCopy for import data into ms sql 2005. I ran a test
when Imported the same 2 files one after another and each one had the same
PK values, but somehow it went through and got duplicate PKs. I thought that
ms sql will gen an err.

Any idea?

Thanks,

Steve
 
Do it again....You must be mistaken..
Double check that you have Primary Key set to what you think it is...

George.
 
if you have a primary key defined on the table it will gen an error, as
dups can not be inserted. if you drop it before the load, then you must
cleanse the data before loading.

-- bruce (sqlwork.com)
 
Back
Top