SqlBulkCopy to SQL Server in Parallel

In an earlier post last year, I blogged about high performance bulk loading to SQL Server from .NET using SqlBulkCopy. That post highlighted the performance gain that SqlBulkCopy gives over another batched insert approach using an SqlDataAdapter. But is it possible to squeeze more performance out? Oh yes. First, a quick recap. For optimal performance: load into a heap table (with no indexes - add any indexes you need AFTER you’ve loaded the data) [Read More]

SqlBulkCopy ColumnMappings Mismatch

“The given ColumnMapping does not match up with any column in the source or destination” This error caused me more head-scratching than it should have done today. I was using SqlBulkCopy to bulk insert some data into an SQL Server table from a .NET DataTable, something I’ve done before - it’s not rocket science. But I hit this error upon calling WriteToServer and it took me a while (longer than it should have done really! [Read More]

High performance bulk loading to SQL Server using SqlBulkCopy

If you ever want to bulk load data into an SQL Server database as quickly as possible, the SqlBulkCopy class is your friend (in the System.Data.SqlClient namespace). Since being introduced in .NET 2.0, it has provided an extremely efficient way to bulk load data into SQL Server, and is one the classes that I see as a “must know about”. A usual scenario is where you want to dump some data into the database to then do some processing on. [Read More]