Reputation: 21
I have 2 questions about SqlBulkCopy:
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?
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
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