Microsoft KB Archive/268846

= BUG: A SELECT Statement With a Number of SUM(CASE) Expressions and UNIONs May Cause Stack Overflow =

Article ID: 268846

Article Last Modified on 10/16/2002

-

APPLIES TO


 * Microsoft SQL Server 7.0 Standard Edition

-



This article was previously published under Q268846



BUG #: 57937(SQLBUG_70)



SYMPTOMS
A query that contains a number of SUM(CASE) expressions along with UNION statements in a subquery might result in a stack overflow exception.

The query might fail with the following error message:

Connection Broken

You may also get a message that indicates that the command completed successfully but you might not get the expected results.



CAUSE
The query processor duplicates the list of correlation variables many times and causes the stack overflow.



WORKAROUND
Re-write the query so that it has less UNION statements, or eliminate the UNION statements altogether.



STATUS
Microsoft has confirmed this to be a problem in SQL Server 7.0.



MORE INFORMATION
The SQL Server error log contains an entry similar to the following when the exception error occurs:  2000-05-16 12:05:36.51 spid8   05/16/00 12:05:36 Stack Overflow Dump not possible - Exception c00000fd E at 00477b30 2000-05-16 12:05:36.51 spid8   Address=477b30 Exception Code = c00000fd 2000-05-16 12:05:36.51 spid8   eax=22685574 ebx=00000000 ecx=00000001 edx=00000001 2000-05-16 12:05:36.51 spid8   esi=22685574 edi=21895574 eip=00477b30 esp=2ff33000 2000-05-16 12:05:36.51 spid8   ebp=2ff33008 efl=00010206 2000-05-16 12:05:36.51 spid8   cs=1b ss=23 ds=23 es=23 fs=3b gs=0 2000-05-16 12:05:36.51 spid8   Input Buffer 3882 bytes - ... ... 2000-05-16 12:05:36.55 spid8   Error: 0, Severity: 19, State: 0 2000-05-16 12:05:36.55 spid8   language_exec: Process 8 generated an access violation. SQL Server is terminating this process. .

Keywords: kbbug kbpending KB268846

-

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

© Microsoft Corporation. All rights reserved.