Sql

Bulk inserting data into SQL Server using C#

In the last few days I had a question: what is the most fastest method to bulk insert data into a SQL Server database using C#? I decided to gather up all methods that I could find and do a very simple performance test to decide which one is the fastest.

Here are my results for inserting 10000 rows over 500 iterations:

MethodTime
SqlBulkCopy class137.022 ms
bcp utility146.876 ms
Table-Valued Parameter150.900 ms
Simple.Data208.320 ms
XQuery235.490 ms

My configuration: