Truncate before SqlBulkCopy

.net sql sqlbulkcopy

Question

I want to truncate a table before doing a SqlBulkCopy. Does SqlBulkCopy automatically truncate a table before copying the data?

Popular Answer

No, not to my knowledge.

I don't see any options on the SqlBulkCopy class that would allow you to instruct SqlBulkCopy to truncate before loading.

You'll have to do that yourself before launching SqlBulkCopy.



Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why