SqlBulkCopy The fastest way to insert your data into SQL Server.

using (SqlBulkCopy bulkCopy = new SqlBulkCopy(connectionString, transaction)) { // SET BatchSize value. bulkCopy.BatchSize = 4000; bulkCopy.DestinationTableName = "TheDestinationTable"; bulkCopy.WriteToServer(dt); }

SqlBulkCopy FAQ



What's SqlBulkCopy?

SqlBulkCopy is a Microsoft class that let you to efficiently bulk insert data to SQL Server table. That is the fastest way to insert multiples rows.



How can I improve SqlBulkCopy performance?

It's possible to improve SqlBulkCopy performance by specifying a batch size (not too low, not too high!) and locking the table using SqlBulkCopyOptions.



What are commons SqlBulkCopy exception?

Here is a list of common SqlBulkCopy exceptions:



How to retrieve identity values with SqlBulkCopy?

You cannot, but a third-party library does: Bulk Operations. It's a prime library that overcome SqlBulkCopy limitations.

Learn More


How to Bulk Update with SqlBulkCopy?

You cannot, but a third-party library does: Bulk Operations. It's a prime library that support all bulk operations:

  • Bulk Insert
  • Bulk Update
  • Bulk Delete
  • Bulk Merge
Learn More


Which provider SqlBulkCopy support?

It support SQL Server & SQL Azure. However more provide can be supported via Bulk Operations. It's a prime library that support all major providers:

  • SQL Server 2008+
  • SQL Azure
  • SQL Compact
  • MySQL
  • SQLite
  • PostgreSQL
  • Oracle
Learn More

Trusted by thousands around the world!

More than 2000 satisfied customers spreaded across over 75 countries


We had a particularly large (500,000 entities) EF save operations that was taking 12 minutes, this is now down to 30 seconds.

Stewart Menday, Australia, New South Wales

That's really cool! I didn't actually expect you to build a new release in just a day, to be honest, but this is really awesome

Kimwan Ogot, USA, Minneapolis

I would absolutely recommend your product. It is simple, cheap, effective.

Consulting

Your company requires some custom solution to extend SqlBulkCopy with more features?

Contact us to learn about our consultation services:
info@zzzprojects.com

You can also find some answers/ help if:

Stack Overflow