Fastest way to update (populate) 1,000,000 records into a database using .NET Fastest way to update (populate) 1,000,000 records into a database using .NET sql sql

Fastest way to update (populate) 1,000,000 records into a database using .NET


Have you tried SSIS? I have never written an SSIS package with a loacldb connection, but this is the sort of activity SSIS should be well suited.

If your data source is a SQL Server, another idea would be setting up a linked server. Not sure if this would work with localdb. If you can set up a linked server, you could bypass the C# all together and load your data with an INSERT .. SELECT ... FROM ... SQL statement.


Remove looping... In SQL, try to make a table with 1 million rows... and left join it use this for insert/select data


Try sending it without storing it in a datatable.

See the example at the end of this post, that allows you to do it with an enumerator http://www.developerfusion.com/article/122498/using-sqlbulkcopy-for-high-performance-inserts/