user7393401
user7393401

Reputation: 21

Can you track errors in SqlBulkCopy

I have 2 questions about SqlBulkCopy:

  1. If I insert a batch of 1000 records and the 990th item doesn't meet validation criteria, does the other 999 records still get inserted into the database or not?

  2. How do you track errors caused by SqlBulkCopy. I have some code here but was wondering how would I track validation errors:

Upvotes: 0

Views: 1386

Answers (1)

PhillipH
PhillipH

Reputation: 6222

SQL Bulk Copy transaction behaviour is covered in the MSDN documentation.

If you want a more fine degree of control, the general method is to BCP into a temporary table, then validation check and insert/update from there into live.

Upvotes: 1

Related Questions