BUG: Fetch From Cursor on Stored Procedure May Cause 1203 Error (235476)



The information in this article applies to:

  • Microsoft SQL Server 6.5 Service Pack 1 and later

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.

REFERENCES

For additional information about trace flag 7502, click the following article number to view the article in the Microsoft Knowledge Base:

152032 INF: Changes to SQL Server 6.5 That Affect 6.0 Apps


Modification Type:MajorLast Reviewed:10/3/2003
Keywords:kbBug kbpending KB235476