Column mappings define the relationships between columns in the data source and columns in the destination.
using (var sqlBulk = new SqlBulkCopy(connection))
{
// SET ColumnMappings values.
sqlBulk.ColumnMappings.Add("Name", "Name");
sqlBulk.ColumnMappings.Add("Country", "Country");
sqlBulk.ColumnMappings.Add("City", "City");
sqlBulk.DestinationTableName = "Customers";
sqlBulk.WriteToServer(dt);
}
The default mapping under the hood of SqlBulkCopy may cause some weird issue because column are not mapped by name but by ordinal. When your table containt an identity value, you may end up by value mapped to wrong column!
See: SqlBulkCopy giving FOREIGN KEY constraint error