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

Our achievements

2000+ Customers
75+ Countries
4000+ Requests closed
Over 10 000 000+ download
Over 1 000 000+ daily visitors

What we achieved over the last 4 years has grown beyond our hopes. But it's not a reason to stop trying to improve further more. Every day, we listen to our clients and give our best to accommodate, help and ease the daily dev workload.



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