FIX: UPDLOCK Locking Option Sets Only Shared Lock with sp_cursor (179222)



The information in this article applies to:

  • Microsoft SQL Server 6.5

This article was previously published under Q179222
BUG #: 16273 (NT: 6.5)

SYMPTOMS

If you open a KEYSET cursor with the locking option UPDLOCK through sp_cursoropen in a transaction, only a shared lock is set on the pages with the qualifying data rows. With the first sp_cursorfetch, an Update_page lock is set.

This leads to a good chance to run into a deadlock.

WORKAROUND

To work around this problem, do either of the following:
  • Use a DYNAMIC or FORWARD-ONLY cursor.

    -or-
  • Use TABLOCK or HOLDLOCK instead of UPDLOCK as optional optimizer hints in the FROM clause.

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.

Modification Type:MajorLast Reviewed:3/14/2006
Keywords:kbBug kbfix KB179222