INF: DECLARE CURSOR on Table Created in Stored Proc FailsLast reviewed: May 1, 1997Article ID: Q136821 |
The information in this article applies to:
SUMMARYIf you create a table in a stored procedure and reference it in a DECLARE CURSOR statement, execution of the stored procedure will fail with:
Msg 202, Level 11, State 2 "Internal error -- Unable to open table at query execution time." MORE INFORMATION- This problem occurs for either temporary or permanent tables. - The error occurs if the table is created with either CREATE TABLE or SELECT INTO.You can avoid this error message by either creating the table before you create the stored procedure, or enclosing the DECLARE CURSOR statement inside an EXEC statement, such as:
EXEC("DECLARE hC CURSOR FOR select * from pubs") |
Additional query words: sql6
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |