Article ID: 180102
Article Last Modified on 3/14/2006
APPLIES TO
- Microsoft SQL Server 6.5 Standard Edition
This article was previously published under Q180102
BUG #: 17763 (6.5)
SYMPTOMS
An error 3905 or 631 can occur if both of the following conditions are true:
- SELECT INTO is used to create temporary tables against tables with identity columns in a user-defined transaction.
-and-
- A table with an identity column is updated.
WORKAROUND
To work around this problem, do either of the following:
- Remove the user-defined transaction and possibly use trace flag 5302 to avoid deadlocks in the tempdb database.
-or-
- Prevent the SELECT INTO statement from creating the temporary table with the identity column. You can do this by using the CONVERT function to convert the identity column to its datatype.
STATUS
Microsoft has confirmed this to be a problem in SQL Server 6.5. This problem has been corrected in Service Pack 5a for Microsoft SQL Server 6.5.For more information, click the following article number to view the article in the Microsoft Knowledge Base:
197177 INF: How to Obtain SQL Server 6.5 Service Pack 5a
For more information, contact your primary support provider.
MORE INFORMATION
The following are the errors that would normally be seen in the SQL Server errorlog when this problem occurs:
or
Normally in this situation, the locks held by the client that caused the error will not be cleaned up, and will still show in the sp_lock stored procedure with a spid of -1. When this problem occurs, clients are unable to create temporary tables, and you can only stop the SQL Server with the SHUTDOWN WITH NOWAIT Transact-SQL statement.
The following is an example of how to avoid the temporary table being created with the identity column property:
CREATE TABLE x (a int identity(1,1), b int) GO CREATE PROCEDURE sp_selectintoidentity AS SELECT Convert(int, a), b INTO #temp FROM x RETURN GO
Additional query words: syscolumns 602
Keywords: kbbug kbfix KB180102