FIX: Force Index Option Fails with Temporary Tables in Stored Procedures

ID: Q175359


The information in this article applies to:

BUG #: 16815 (6.5) 9986 (6.0)

SYMPTOMS

If the "force index" Optimizer hint is used on a query against a temporary table, the query may fail with the following error:

Error 308 Severity 16
Index %s on table %s (specified in the from clause) does not exist.
This error message occurs if both of the following conditions are true: Note that the stored procedure will work if it is run under the same connection it was created on. Also, if it is run successfully under the same connection it was created on, then it will always work for all connections after that.


WORKAROUND

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.


STATUS

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.


MORE INFORMATION

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