FIX: Force Index Option Fails with Temporary Tables in Stored ProceduresID: Q175359
|
If the "force index" Optimizer hint is used on a query against a temporary table, the query may fail with the following error:
This error message occurs if both of the following conditions are true:Error 308 Severity 16
Index %s on table %s (specified in the from clause) does not exist.
The stored procedure runs correctly if you EXEC it in the same batch in
which the stored procedure is created. However, if you execute the stored
procedure from another session, it must be recompiled (as when the server
restarts).
A more permanent workaround is to submit the SELECT statement within the
stored procedure by using the SQL Server 6.0 EXEC feature, rather than a
straight SELECT.
Microsoft has confirmed this to be a problem in SQL Server
version 6.5. This problem has been corrected in U.S. Service Pack 5a
for Microsoft SQL Server version 6.5. For information about
downloading and installing the latest SQL Server Service Pack, see
http://support.microsoft.com/support/sql/.
For more information, contact your primary support provider.
Additional query words: proc
Keywords : kbusage SSrvStProc kbbug6.50 kbfix6.50.SP5
Version : winnt:6.0,6.5
Platform : winnt
Issue type : kbbug
Last Reviewed: April 21, 1999