BUG: Stored Procedure Execution Fails with Msg 202

Last reviewed: June 5, 1997
Article ID: Q169376
The information in this article applies to:
  • Microsoft SQL Server, version 6.5
BUG #: 16945 (WINDOWS: 6.5)

SYMPTOMS

When you execute a stored procedure, it fails and returns the following error:

   Msg 202, Level 11, State 2
   Internal error -- Unable to open table at query execution time.

CAUSE

The stored procedure does all the following:

  • Creates a permanent table using the CREATE TABLE statement
  • Drops the permanent table
  • Creates a temporary table
  • Declares a cursor on the temporary table
  • Drops the temporary table

WORKAROUND

To work around this problem, do any of the following and then drop and re-create the stored procedure:

  • Use the SELECT INTO statement to create the permanent table
  • Eliminate either of the DROP TABLE statements
  • Wrap the DECLARE CURSOR within an EXEC()
  • Create the stored procedure WITH RECOMPILE or always execute it with the WITH RECOMPILE option.

STATUS

Microsoft has confirmed this to be a problem in Microsoft SQL Server version 6.5. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.


Keywords : kbbug6.50 kbusage SSrvStProc
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: June 5, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.