How to prevnt duplicate PKs when using SqlBulkCopy

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
 
G

George

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

George.
 
B

bruce barker

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top