jesvin
jesvin

Reputation: 65

Will the identity column work in bulk insert?

I have a table with identity column. While inserting the data into table using bulk insert the identity column is not incrementing. I created the text file like the format of the file without the identity column field. Also I created the format file using the following cmd commands.

**

bcp -T -E -c

**

could any one help me in this case? if any further reference need just give a replay.

Upvotes: 0

Views: 2359

Answers (2)

E. Arslan
E. Arslan

Reputation: 11

Add the identity column to the end of the table. All the columns till the identity column must match with your data file and the table. So make sure there is no data defined in the data file for the identity column.

Upvotes: 1

Mikael Eriksson
Mikael Eriksson

Reputation: 139010

Remove -E

http://msdn.microsoft.com/en-us/library/ms162802.aspx

Specifies that identity value or values in the imported data file are to be used for the identity column. If -E is not given, the identity values for this column in the data file being imported are ignored, and SQL Server automatically assigns unique values based on the seed and increment values specified during table creation.

Upvotes: 1

Related Questions