BUG: Msg 16916 and AV If Cursor Is Declared but Not Opened

Last reviewed: July 9, 1997
Article ID: Q171101
The information in this article applies to:
  • Microsoft SQL Server, versions 6.5 and 6.5 Service Pack 1
BUG #: 16172 (Windows NT: 6.5)

SYMPTOMS

If a cursor is declared and deallocated, but not opened on the first execution of a stored procedure or trigger, the next execution of the stored procedure or trigger where the cursor is opened results in the following error:

   Msg 16916, Level 16, State 1
   A cursor with the name '<cursor>' does not exist

This error may be followed by a handled access violation (AV) that terminates the client connection.

WORKAROUND

To work around this problem, open the cursor before deallocating it.

STATUS

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

MORE INFORMATION

If you try to drop the stored procedure after the handled access violation, you will encounter the following error message:

   Msg 3702, Level 16, State 3 Cannot drop the procedure '<procedure>'
   because it is currently in use.

You must restart SQL Server to drop and re-create the procedure.


Keywords : kbbug6.50 kbusage SSrvTran_SQL
Version : 6.5
Platform : WINDOWS
Issue type : kbbug
Resolution Type : kbworkaround


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: July 9, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.