Jeff's SQL Server Blog

Random Thoughts & Cartesian Products with Microsoft SQL Server
posts - 157, comments - 2686, trackbacks - 64

My Links

Advertisement

News

Welcome to my weblog. My name is Jeff Smith, I am software developer in Boston, MA and I was recently named a 2009 SQL Server MVP. Check in frequently for tips, tricks, commentary and ideas on SQL Server and .NET programming.


Subscribe





Archives

Post Categories

Programming

Sports

SQL

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

Print | posted on Monday, May 07, 2007 9:29 AM | Filed Under [ .NET (C# / VB) Links Imports/Exports ]

Feedback

Gravatar

# re: Using SQLBulkCopy to quickly transfer data from .NET to SQL Server

use the sqlbulkcopy for upload the dat for table with vb.net
11/27/2007 4:46 AM | Anuranga Peiris
Gravatar

# 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
10/22/2008 1:09 AM | Dev
Gravatar

# re: Using SQLBulkCopy to quickly transfer data from .NET to SQL Server

materila is very nice
10/30/2008 4:43 AM | somas
Comments have been closed on this topic.

Powered by:
Powered By Subtext Powered By ASP.NET