Forum Discussion
CaptainKernel
Feb 08, 2024Copper Contributor
SqlBulkCopy - Confusing documentation
I'm seeing behavior when using this class that doesn't seem to correspond to the class's documentation.
I use a bulk insert to insert 20 million rows, I set the batch size to 5000 and do not use a transaction and do not specify UseInternalTransaction.
The operation sometimes times out, when that happens there are no rows in the table, not even one. The docs seem to say that when writing in batches and a write fails, all the previously written batches will be in the DB, since there's no transaction these do not get rolled back.
So why would I never ever see any rows at all? surely some of the batches worked before the timeout arose? I've also seen failures when there might be data that's invalid for one of the columns and again, when that happens the table remains empty.
Can anyone explain this?
1 Reply
Sort By
- olafhelperBronze ContributorIf your process is blocked from the very beginning by an other process writing to the same table, then you process can't write any record.