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?
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.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.