Wednesday, September 24, 2008

Bulk inserts and updates

A common development task is transferring data between disparate data sources. In this post have outlined a few approaches that can help you to do bulk inserts and updates.

1. Bulk inserts and updates by using the OpenXML method.
OpenXML method is one of the approaches to do bulk inserts and updates with different Microsoft .NET data providers.

Following are two good articles on this
http://support.microsoft.com/kb/315968
http://dotnet.org.za/ncode/archive/2007/05/14/Bulk-Update-and-Insert-of-Object-State-Stored-by-SQL-Server-2000-Using-.NET-C_2300_.aspx

2. SqlBulkCopy to streamline data transfers
The .NET Framework 2.0's SqlBulkCopy class allows you to easily move data programmatically from any data source to a SQL Server table.

Here are some articles that throw light on this
http://video.techrepublic.com.com/5100-10878_11-6187181.html
http://www.codeproject.com/KB/database/TransferUsingSQLBulkCopy.aspx
http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlbulkcopy.aspx

3. Bulk copy large files using bcp
The bcp (bulk copy) command allows you to quickly bulk copy large files into SQL Server tables or views. With .NET Framework 1.1, you can utilize bcp via a SqlCommand object.

Following is an article that talks of bcp:

No comments: