BUG: SPs w/ Aggregate Functions in HAVING Clause can Cause AVs (199720)



The information in this article applies to:

  • Microsoft SQL Server 6.5

This article was previously published under Q199720
BUG #: 16906 (SQLBUG_65)

SYMPTOMS

Running a stored procedure that meets the following conditions can cause handled exceptions or result in message 107:
  • The stored procedure has an aggregate in its HAVING clause.
  • The underlying table on which this having clause depends is dropped and recreated.
The text of this error message is:
Msg 107: The column prefix '' does not match with a table name or alias name used in the query.
Recompiling the stored procedure does not eliminate the problem, and neither does creating the procedure with the 'WITH RECOMPILE' option.

WORKAROUND

Drop and recreate the stored procedure

STATUS

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

Modification Type:MajorLast Reviewed:10/3/2003
Keywords:kbBug kbpending KB199720