Copying Data Containing Identity Values

The bcp utility and BULK INSERT statement allow data files containing identity values to be bulk copied into Microsoft® SQL Server™. The bcp utility accepts the -E parameter, and the BULK INSERT statement accepts the KEEPIDENTITY clause, that can be used to prevent SQL Server from supplying identity values. While the rows in the data file are bulk copied into the table, SQL Server does not assign unique identity values automatically; the identity values are taken from the data file.

If these options are not supplied, the values for the identifier column in the data file being imported are ignored and SQL Server assigns unique values automatically based on the seed and increment values specified during table creation. If the data file does not contain values for the identifier column in the table, use a format file to specify that the identifier column in the table should be skipped when importing data; SQL Server assigns unique values automatically for the column.

See Also
bcp Utility ServerBCPKeepIdentity Property
BULK INSERT Using a Data File with Fewer Fields
IncludeIdentityValues Property  

  


(c) 1988-98 Microsoft Corporation. All Rights Reserved.