Microsoft KB Archive/916795

= FIX: Error message when you run a query inside a stored procedure in SQL Server 2005: &quot;Internal query processor error&quot; =

Article ID: 916795

Article Last Modified on 11/20/2007

-

APPLIES TO


 * Microsoft SQL Server 2005 Enterprise Edition
 * Microsoft SQL Server 2005 Developer Edition
 * Microsoft SQL Server 2005 Standard Edition
 * Microsoft SQL Server 2005 Enterprise X64 Edition
 * Microsoft SQL Server 2005 Standard X64 Edition
 * Microsoft SQL Server 2005 Enterprise Edition for Itanium-based Systems

-



Bug #: 531 (SQL Hotfix)



SYMPTOMS
When you run a query inside a stored procedure in Microsoft SQL Server 2005, the SQL Server Optimizer may be unable to produce an execution plan. Additionally, you may receive an error message that resembles the following:

Server: Msg 8624, Level 16, State 116, Line 1

Internal Query Processor Error: The query processor could not produce a query plan. For more information, contact Customer Support Services.



RESOLUTION
A supported hotfix is now available from Microsoft. However, this hotfix is intended to correct only the problem that is described in this article. Apply this hotfix only to systems that are experiencing this specific problem. This hotfix might receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next service pack that contains this hotfix.

To resolve this problem, submit a request to Microsoft Online Customer Services to obtain the hotfix. To submit an online request to obtain the hotfix, visit the following Microsoft Web site:

http://go.microsoft.com/?linkid=6294451

Note If additional issues occur or any troubleshooting is required, you might have to create a separate service request. The usual support costs will apply to additional support questions and issues that do not qualify for this specific hotfix. To create a separate service request, visit the following Microsoft Web site:

http://support.microsoft.com/contactus/?ws=support

Prerequisites
No prerequisites are required to apply this hotfix.

Restart requirement
You do not have to restart the computer after you apply this hotfix.

Hotfix replacement information
This hotfix does not replace any other hotfixes.

File information
The English version of this hotfix has the file attributes (or later file attributes) that are listed in the following table. The dates and times for these files are listed in Coordinated Universal Time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time item in Control Panel.

SQL Server 2005 Itanium-based versions


WORKAROUND
To work around this problem, rewrite the query to use a format that resembles the following example query: SELECT * FROM View1 V INNER JOIN Table3 T ON V.V1C1 <= T.T3C1 LEFT OUTER JOIN Table4 ON V.V1C1 = Table4.T4C1



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the &quot;Applies to&quot; section.



MORE INFORMATION
For more information, click the following article number to view the article in the Microsoft Knowledge Base:

824684 Description of the standard terminology that is used to describe Microsoft software updates

This hotfix is also included in cumulative hotfix package (build 2153) for SQL Server 2005. For more information about cumulative hotfix package 918222, click the following article number to view the article in the Microsoft Knowledge Base:

918222 Cumulative hotfix package (build 2153) for SQL Server 2005 is available



Steps to reproduce the problem
  Create the following four tables: CREATE TABLE Table1 (T1C1 int check (T1C1 > 1)) CREATE TABLE Table2 (T2C1 int check (T2C1 > 2)) CREATE TABLE Table3 (T3C1 int ) CREATE TABLE Table4 (T4C1 int check (T4C1 < 1))   Create the following view: CREATE VIEW View1 AS SELECT T1C1 V1C1 FROM Table1 UNION ALL SELECT T2C1 V1C1 FROM Table2   Insert data into the four tables that you created in step 1: INSERT INTO Table1 VALUES (2)

INSERT INTO Table2 VALUES (3)

INSERT INTO Table3 VALUES (1) INSERT INTO Table3 VALUES (2) INSERT INTO Table3 VALUES (3)

INSERT INTO Table4 VALUES (-1) INSERT INTO Table4 VALUES (-2)   Run the following query to reproduce the error message that is mentioned in the &quot;Symptoms&quot; section: SELECT * FROM View1 V INNER JOIN Table3 T ON V.V1C1 <= T.T3C1 WHERE V.V1C1 NOT IN (SELECT T4C1 FROM Table4) </ol>

Keywords: kberrmsg kbbug kbfix kbqfe kbpubtypekc kbhotfixserver KB916795

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.