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

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 query words: 6.00 sp3 6.00.sp3 ANSI

Keywords : kbusage SSrvGPF SSrvTran_SQL kbbug6.00.sp3
Version : 6.0.sp3
Platform : WINDOWS
Issue type :


Last Reviewed: April 8, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.