Microsoft KB Archive/235476

= BUG: Fetch From Cursor on Stored Procedure May Cause 1203 Error =

Article ID: 235476

Article Last Modified on 10/3/2003

-

APPLIES TO


 * Microsoft SQL Server 6.5 Service Pack 1

-



This article was previously published under Q235476



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 that this is a problem in the Microsoft products that are listed at the beginning of this article.

