FIX: Complex CASE Clause on Query May Cause Error 8621 and Terminate Batch (306998)



The information in this article applies to:

  • Microsoft SQL Server 2000 (all editions)

This article was previously published under Q306998
BUG #: 355294 (SHILOH_BUGS)
BUG #: 355550 (SHILOH_BUGS)

SYMPTOMS

When you attempt to run a query with a CASE statement that contains several WHEN expressions, the query may fail with this error message and the batch in which it exists terminates:
Error 8621, Level 17, State 1
Internal Query Processor Error: The query processor ran out of stack space during query optimization.

RESOLUTION

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

290211 INF: How to Obtain the Latest SQL Server 2000 Service Pack

Hotfix

NOTE: The following hotfix was created prior to Microsoft SQL Server 2000 Service Pack 2.

The English version of this fix should have the following file attributes or later:
   Date         Time         Version    Size           File name
   -----------------------------------------------------------------

   2001-09-13   8:23:58 PM   8.00.445   7,409,745 KB   Sqlservr.exe
				
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 problem, you can simplify the complex CASE statement by breaking up the CASE statement into multiple queries.

STATUS

Microsoft has confirmed that this is a problem in Microsoft SQL Server 2000. This problem was first corrected in Microsoft SQL Server 2000 Service Pack 2.

Modification Type:MinorLast Reviewed:9/26/2005
Keywords:kbHotfixServer kbQFE kbBug kbfix kbSQLServ2000preSP2Fix KB306998