Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can Bulk Insert work on a table with Identity field?

Status
Not open for further replies.

PManion

Programmer
Feb 11, 2002
13
US
Is it possible to do a Bulk Insert on a table that has a field with the Identity attribute? I have been trying to find a fast way to load data to a table with an autoincrementing field and had no luck. Any suggestions?
 
Yeah
dont supply the ID field in the input file.
 
BOL:


BULK INSERT ['database_name'.] [ 'owner' ] 'table_name' FROM 'data_file'
WITH KEEPIDENTITY


KEEPIDENTITY

Specifies that the values for an identity column are present in the file imported. If KEEPIDENTITY is not given, the identity values for this column in the data file imported are ignored, and SQL Server automatically assigns unique values based on the seed and increment values specified during table creation. If the data file does not contain values for the identity column in the table or view, use a format file to specify that the identity column in the table or view should be skipped when importing data; SQL Server automatically assigns unique values for the column. For more information, see DBCC CHECKIDENT.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top