Microsoft KB Archive/164056

From BetaArchive Wiki
Knowledge Base


Article ID: 164056

Article Last Modified on 8/10/2006



APPLIES TO

  • Microsoft SQL Server 6.5 Standard Edition



This article was previously published under Q164056

BUG #: 16515 (6.5)

SYMPTOMS

You may receive the following error 16934 when performing an optimistic lookup:

Optimistic concurrency check failed, the row was modified outside of this cursor.


This problem may occur if you do all of the following:

  • Dump and load a database containing a stored procedure into a different database.
  • Declare an extended keyset or dynamic cursor on that stored procedure.
  • Do an sp_cursor positioned update using CU_OPTCC (optimistic check by value or timestamp) or CU_OPTCCVAL (optimistic check by value).

This problem does not occur if the database is dumped and loaded back to the same database.

WORKAROUND

After the dump and load to a different database, drop and re-create the stored procedure on which the cursor is declared.

STATUS

Microsoft has confirmed this to be a problem in Microsoft SQL Server version 6.5. This problem has been corrected in U.S. Service Pack 3 for Microsoft SQL Server version 6.5. For more information, contact your primary support provider.

MORE INFORMATION

Error message 16934 is not intrinsically wrong. It merely indicates that during a cursor read, browse, or update operation, the optimistic lookup detected a changed row. However, in this particular case, error 16934 is wrong because no update to the underlying row took place.

SQL Server supports two different server-side cursor interfaces. One is ANSI SQL cursors, exposed through Transact-SQL statements such as DECLARE, FETCH, and so on. There is also an extended cursor interface that is accessed by means of the DB-Library and ODBC APIs. The sp_cursor extended cursor statements are emitted by the DB-Library or ODBC layers in response to certain DB-Library or ODBC API calls. Higher-level interfaces such as Remote Data Objects (RDO) often encapsulate these API-level calls, so you would need to run a trace utility such as SQL Trace to verify the sp_cursor call being made.


Keywords: kbbug kbfix kbusage KB164056