BUG: Correlated Subquery in Col. List May Cause Divide by Zero

Last reviewed: April 15, 1997
Article ID: Q163909
The information in this article applies to:
  • Microsoft SQL Server, version 6.0 Service Pack 3
BUG #: 15695 (6.0)

SYMPTOMS

Complex queries may cause an unhandled Divide By Zero exception error that causes SQL Server to shut down. The query must include the following things for this problem to occur:

  • A correlated subquery in the Select list.
  • An aggregate function in the Select list.
  • A Group By clause with columns.
  • A Having clause based on the aggregate function in the Select list.

WORKAROUND

To work around this problem, rewrite the correlated subquery, using a join in the Where clause.

STATUS

Microsoft has confirmed this to be a problem in Microsoft SQL Server version 6.0 Service Pack 3. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

This problem occurs while optimizing the query. It even occurs if you use SET NOEXEC ON.

In addition to the unhandled exception error, the following error also appears in the errorlog:

   Error : 913, Severity: 22, State: 2
   Could not find row in Sysdatabases with database id 0. Run DBCC
   CHECKTABLE on Sysdatabases.


Additional reference words: 6.00 sp3 6.00.sp3 ANSI
Keywords : kbbug6.00.sp3 kbusage SSrvGPF SSrvTran_SQL
Version : 6.0.sp3
Platform : WINDOWS


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: April 15, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.