SqlBulkCopyColumnMapping Constructor ()

 

Default constructor that initializes a new SqlBulkCopyColumnMapping object.

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

public:
SqlBulkCopyColumnMapping()

If you use this constructor, you must then define the source for the mapping using the SourceColumn property or the SourceOrdinal property, and define the destination for the mapping using the DestinationColumn property or the DestinationOrdinal property.

The following example bulk copies data from a source table in the AdventureWorks sample database to a destination table in the same database. Although the number of columns in the destination matches the number of columns in the source, the column names and ordinal positions do not match. SqlBulkCopyColumnMapping objects are used to create a column map for the bulk copy.

System_CAPS_importantImportant

This sample will not run unless you have created the work tables as described in Bulk Copy Example Setup. This code is provided to demonstrate the syntax for using SqlBulkCopy only. If the source and destination tables are in the same SQL Server instance, it is easier and faster to use a Transact-SQL INSERT … SELECT statement to copy the data.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 2.0
Return to top
Show: