Using SQLBulkCopy to quickly transfer data from .NET to SQL Server
My latest article has just been posted over at SQLTeam.com:
.NET Framework 2.0 introduces a very handy new class in the System.Data.SqlClient namespace called SqlBulkCopy that makes it very easy and efficient to copy large amounts of data from your .NET applications to a SQL Server database. You can even use this class to write a short .NET application that can serve as a "middleman" to move data between database servers.
If you ever need to move large amounts of data to SQL Server from a .NET application, SQLBulkCopy is the way to go. What's great about it is that you can use a populated DataTable as the source, or anything that implements IDataReader. This means that you can use SQLBulkCopy to quickly move data from any OLEDB/ODBC datasource to SQL Server.
Informal testing shows that it is about 4 times as fast as executing INSERT statements over and over when copying large amounts of data from a DataTable, and it certainly is much shorter and easier to write and maintain.
I hope you find the article and the examples given useful.
Article link
Legacy Comments
Anuranga Peiris
2007-11-27 |
re: Using SQLBulkCopy to quickly transfer data from .NET to SQL Server use the sqlbulkcopy for upload the dat for table with vb.net |
Dev
2008-10-22 |
re: Using SQLBulkCopy to quickly transfer data from .NET to SQL Server we can use this to transfer data from MS Access to SQL server. See following thing: http://urenjoy.blogspot.com/2008/10/moving-data-from-access-to-sql-server.html |
somas
2008-10-30 |
re: Using SQLBulkCopy to quickly transfer data from .NET to SQL Server materila is very nice |