BUG: Fetch From Cursor on Stored Procedure May Cause 1203 Error
ID: Q235476
|
The information in this article applies to:
-
Microsoft SQL Server version 6.5 Service Pack 1 and later
BUG #: 18632 (SQLBUG_65)
SYMPTOMS
When the following conditions are met:
- A dynamic or forward_only cursor is defined on a stored procedure.
- The cursor is opened with locking concurrency.
- The stored procedure performs a SELECT from a table.
- The SELECT does not use a clustered index to retrieve the data.
SQL Server may repetitively log the following error in the errorlog:
Msg 1203, Level 20, State 2
Caller of lock manager is incorrectly trying to unlock an unlocked object. spid=12 locktype=7 dbid=6 lockid=1002.
WORKAROUND
Use any of the following workarounds:
- Enable trace flag 7502 by issuing the following query:
dbcc traceon(-1, 7502)
- Define the cursor as static or keyset.
- Define the cursor to use either read only or optimistic concurrency.
- Create a clustered index on the table and make sure that the SELECT statement will use the index.
STATUS
Microsoft has confirmed this to be a problem in SQL Server version 6.5 Service Pack 1 and later.
REFERENCES
For further information on trace flag 7502, see the following article in the Microsoft Knowledge Base article:
Q152032 INF: Changes to SQL Server 6.5 That Affect 6.0 Apps
Additional query words:
Keywords : kbSQLServ650bug
Version : winnt:6.5 Service Pack 1 and later
Platform : winnt
Issue type : kbbug
Last Reviewed: July 2, 1999