FIX: UNION query returns internal query processor error message 8623

Article translations Article translations
Article ID: 286255 - View products that this article applies to.
This article was previously published under Q286255
This article has been archived. It is offered "as is" and will no longer be updated.
BUG #: 351259 (SHILOH_BUGS)
Expand all | Collapse all

On This Page

SYMPTOMS

A query statement may fail with error message 8623 if the following conditions are met:
  • The query uses the UNION clause.

  • One of the SELECT statements in the UNION query has a WHERE clause that refers to a subquery through an IN clause.

  • The SQL Server query optimizer chooses a loop join to resolve the query.
The complete text of the error message is:
Server: Msg 8623, Level 16, State 1, Line 1 Internal Query Processor Error: The query processor could not produce a query plan. Contact your primary support provider for more information.

RESOLUTION

Service pack information

To resolve this problem, obtain the latest service pack for Microsoft SQL Server 2000. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
290211 How to obtain the latest service pack for SQL Server 2000

Hotfix information

A supported hotfix is 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.

If the hotfix is available for download, there is a "Hotfix download available" section at the top of this Knowledge Base article. If this section does not appear, submit a request to Microsoft Customer Service and Support to obtain the hotfix.

Note If additional issues occur or if 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. For a complete list of Microsoft Customer Service and Support telephone numbers or to create a separate service request, visit the following Microsoft Web site:
http://support.microsoft.com/contactus/?ws=support
Note The "Hotfix download available" form displays the languages for which the hotfix is available. If you do not see your language, it is because a hotfix is not available for that language. The English version of this fix should have the following file attributes or later:
   Date         Time     Version    Size      File name      Platform
   -------------------------------------------------------------------

   01/13/2001   12:52a   8.00.240   7446589   Sqlservr.exe   Intel

				
NOTE: Due to file dependencies, the most recent hotfix or feature that contains the preceding files may also contain additional files.

WORKAROUND

To work around this behavior:
  • Rewrite the query statement and use a join instead of the IN clause subquery.

    -or-

  • Use the OPTION optimizer hint to force a hash union. The example query in the "More Information" section would change to:

    SELECT P.EMP_NO, N.ADJ_SCON
      FROM   BATCH_EMPEE P, EMPLOYEE E, NI_CONDITION N
      WHERE  E.EMP_NO = P.EMP_NO AND
             N.EMP_NO = E.EMP_NO AND
             P.JOB_ID = 25 AND
             N.PAYRUN_NO = 0
    
      UNION
    
      SELECT P.EMP_NO, ''
      FROM   BATCH_EMPEE P, EMPLOYEE E
      WHERE  E.EMP_NO = P.EMP_NO AND
             P.JOB_ID = 25 AND
             E.EMP_NO NOT IN
                 (SELECT EMP_NO FROM NI_CONDITION WHERE PAYRUN_NO = 0)
    
      OPTION (HASH UNION)
    					

STATUS

Microsoft has confirmed this to be a problem in SQL Server 2000. This problem was first corrected in SQL Server 2000 Service Pack 1.

MORE INFORMATION

The following query is an example for a statement that might lead to error message 8623:
SELECT P.EMP_NO, N.ADJ_SCON
  FROM   BATCH_EMPEE P, EMPLOYEE E, NI_CONDITION N
  WHERE  E.EMP_NO = P.EMP_NO AND
         N.EMP_NO = E.EMP_NO AND
         P.JOB_ID = 25 AND
         N.PAYRUN_NO = 0

  UNION

  SELECT P.EMP_NO, ''
  FROM   BATCH_EMPEE P, EMPLOYEE E
  WHERE  E.EMP_NO = P.EMP_NO AND
         P.JOB_ID = 25 AND
         E.EMP_NO NOT IN
             (SELECT EMP_NO FROM NI_CONDITION WHERE PAYRUN_NO = 0)
				

Properties

Article ID: 286255 - Last Review: February 28, 2014 - Revision: 4.3
APPLIES TO
  • Microsoft SQL Server 2000 Developer Edition
  • Microsoft SQL Server 2000 Enterprise Edition
  • Microsoft SQL Server 2000 Personal Edition
  • Microsoft SQL Server 2000 Standard Edition
  • Microsoft SQL Server 2000, Workgroup Edition
Keywords: 
kbnosurvey kbarchive kbautohotfix kbhotfixserver kbbug kbfix kbqfe KB286255

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com