Knowledge Base

BUG: BCP Into a Table w/ IDENTITY Column Cannot Be Performed

Article ID: 136533

Article Last Modified on 2/14/2005


APPLIES TO


This article was previously published under Q136533
BUG #: 10361 (6.00)

SYMPTOMS

A bulk copy into a table with an IDENTITY column cannot be performed when a value for the IDENTITY column has not been specified in the data file.

WORKAROUND

To work around this problem, do one of the following:
  • Make sure a value is present for the IDENTITY column in the data file. If the values present in the data file are the actual values to be inserted in the table, use the /E option. If SQL Server-generated values need to be used, run the bulk copy program (BCP) without the /E option.


-or-


  • Perform the following steps:

    Create a temporary table without an IDENTITY column.Bulk copy the data into the table created in step 1.Use INSERT INTO or SELECT INTO to insert the data into the original table from the temporary table.

STATUS

Microsoft has confirmed this to be a problem in SQL Server versions 6.0 and 6.5. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

BCP IN into a table will work if any value is specified for the IDENTITY column. You can use the /E option when identity values are present within the table to be imported. Without the /E option, the SQL Server will generate identity values for the rows.

Additional query words: sql6 import temp tbl insert/select

Keywords: kbbug KB136533