System.Data.SqlClient.SqlBulkCopy Class

Lets you efficiently bulk load a SQL Server table with data from another source.

See Also: SqlBulkCopy Members


public sealed class SqlBulkCopy : IDisposable


Microsoft SQL Server includes a popular command-prompt utility named bcp for moving data from one table to another, whether on a single server or between servers. The System.Data.SqlClient.SqlBulkCopy class lets you write managed code solutions that provide similar functionality. There are other ways to load data into a SQL Server table (INSERT statements, for example), but System.Data.SqlClient.SqlBulkCopy offers a significant performance advantage over them.

The System.Data.SqlClient.SqlBulkCopy class can be used to write data only to SQL Server tables. However, the data source is not limited to SQL Server; any data source can be used, as long as the data can be loaded to a System.Data.DataTable instance or read with a System.Data.IDataReader instance.

System.Data.SqlClient.SqlBulkCopy will fail when bulk loading a System.Data.DataTable column of type System.Data.SqlTypes.SqlDateTime into a SQL Server column whose type is one of the date/time types added in SQL Server 2008.


Namespace: System.Data.SqlClient
Assembly: System.Data (in System.Data.dll)
Assembly Versions: