Article ID: 288957 - View products that this article applies to.
This article was previously published under Q288957
This article has been archived. It is offered "as is" and will no longer be updated.
BUG #: 236595 (SHILOH_BUGS)
SQL Server may return incorrect results for a query if all of the following conditions are true:
The optimizer attempts to find duplicate aggregate functions in the query so that each unique aggregate is only calculated once. That code fails to take into account the secondary parameters that are being passed to a UDF and might incorrectly identify two aggregates as equivalent.
To resolve this problem, obtain the latest service pack for Microsoft SQL Server 2000. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:
(http://support.microsoft.com/kb/290211/EN-US/ )INF: How to Obtain the Latest SQL Server 2000 Service Pack
HotfixNOTE: The following hotfix was created prior to Microsoft SQL Server 2000 Service Pack 1.
The English version of this fix should have the following file attributes or later:
Version File name Platform ------------------------------------- 8.00.251 s80251i.exe x86
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article. This problem was first corrected in Microsoft SQL Server 2000 Service Pack 1.
The following example demonstrates the problem.
Note how you obtain incorrect results only if both references to the UDF pass the same first parameter, either as a column name or literal value, to the function.