BUG: Inserting Data into Temporary Table's Identity Column in Stored Procedure Fails (234521)
The information in this article applies to:
This article was previously published under Q234521
BUG #: 55534 (SQLBUG_70)
SYMPTOMS
If you run a stored procedure that inserts data into a temporary table that contains an identity column, the second and all subsequent executions of the procedure fail with the following error:
Server: Msg 544, Level 16, State 1
Cannot insert explicit value for identity column in table 'objid' when IDENTITY_INSERT is set to OFF
The following conditions produce this error:
- The stored procedure must be inserting data into the Identity column.
- The table involved must be a temporary table. If the table created in the store procedure is a permanent table, it will not fail.
WORKAROUND
Use any one of the following workarounds:
- Create the stored procedure using WITH RECOMPILE.
- Run the stored procedure using WITH RECOMPILE.
- Use a permanent table instead of a temporary table.
STATUS
Microsoft has confirmed this to be a problem in SQL Server 7.0.
Modification Type: | Major | Last Reviewed: | 10/16/2002 |
---|
Keywords: | kbBug KB234521 |
---|
|