Microsoft KB Archive/163909

{|
 * width="100%"|

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

 * }

Q163909

-

The information in this article applies to:


 * Microsoft SQL Server versions 6.0, 6.0 Service Pack 3, 6.5

-

BUG #: 15695 (6.0)

SYMPTOMS
Complex queries may cause an Divide By Zero exception error. On SQL Server 6.0 this may be an unhandled exception that can cause SQL Server to shut down. On SQL Server 6.5 the exception will be handled and will only affect the connection running the query. The query must include the following conditions 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 and SQL Server 6.5. 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

Issue type :

Technology : kbSQLServSearch kbAudDeveloper kbSQLServ600 kbSQLServ650 kbSQLServ600SP3