Article ID: 883415 - Last Review: November 2, 2007 - Revision: 3.3 FIX: A user-defined function returns results that are not correct for a query
Bug #: 358054 (SQL Server 8.0) Microsoft distributes SQL Server 2000 fixes as one downloadable file. Because the fixes are cumulative, each new release contains all the hotfixes and all the security fixes that were included with the previous SQL Server 2000 fix release. On This PageSUMMARYThis article describes the following about this hotfix
release:
INTRODUCTIONA user-defined function returns results that are not correct
for a query if all the following conditions are true:
Important To resolve this problem, you must install this hotfix and turn on trace flag 9056. You can turn on trace flag 9056 by adding -T9056 to the SQL Server command line or by using DBCC TRACEON(9056, -1) from a query connection. RESOLUTIONService pack informationTo resolve this problem, obtain the latest service pack for Microsoft SQL Server 2000. For more information, click the following article number to view the article in the Microsoft Knowledge Base:290211
(http://support.microsoft.com/kb/290211/
)
How to obtain the latest SQL Server 2000 service pack
Hotfix informationPrerequisitesThis hotfix requires SQL Server 2000 Service Pack 3 (SP3). For additional information about how to obtain SQL Server 2000 Service Pack 3, click the following article number to view the article in the Microsoft Knowledge Base:290211
(http://support.microsoft.com/kb/290211/
)
How to obtain the latest SQL Server 2000 service pack
Restart informationYou do not have to restart your computer after you apply this hotfix.Registry informationYou do not have to update the registry after you apply this hotfix.Hotfix file informationThis hotfix contains only those files that are required to correct the issues that this article lists. This hotfix may not contain of all the files that you must have to fully update a product to the latest build.The English version of this hotfix has the file attributes (or later file attributes) that are listed in the following table. The dates and times for these files are listed in coordinated universal time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time tool in Control Panel. Date Time Version Size File name ------------------------------------------------------------------------ 22-Jul-2004 15:00 2000.80.962.0 664,128 Autoplt.dll 22-Jul-2004 14:59 2000.80.962.0 78,400 Console.exe 22-Jul-2004 15:00 2000.80.962.0 315,968 Custtask.dll 22-Jul-2004 15:00 2000.80.962.0 33,340 Dbmslpcn.dll 08-Apr-2004 12:42 786,432 Distmdl.ldf 08-Apr-2004 12:42 2,359,296 Distmdl.mdf 10-Oct-2003 09:48 180 Drop_repl_hotfix.sql 22-Jul-2004 15:00 2000.80.962.0 1,905,216 Dtspkg.dll 22-Jul-2004 15:00 2000.80.962.0 528,960 Dtspump.dll 22-Jul-2004 15:00 2000.80.962.0 1,557,052 Dtsui.dll 22-Jul-2004 15:00 2000.80.962.0 639,552 Dtswiz.dll 10-Oct-2003 09:48 747,927 Instdist.sql 10-Oct-2003 09:48 1,581 Inst_repl_hotfix.sql 22-Jul-2004 14:59 2000.80.962.0 352,828 Isqlw.exe 22-Jul-2004 14:59 2000.80.962.0 82,492 Itwiz.exe 22-Jul-2004 15:00 2000.80.962.0 90,692 Msgprox.dll 19-May-2004 14:43 8.11.40209.0 209,408 Mssdi98.dll 22-Jul-2004 15:00 2000.80.962.0 62,024 Odsole70.dll 22-Jul-2004 15:00 2000.80.962.0 25,144 Opends60.dll 22-Jul-2004 14:59 2000.80.962.0 57,904 Osql.exe 22-Jul-2004 15:00 2000.80.962.0 279,104 Pfutil80.dll 10-Oct-2003 09:37 550,780 Procsyst.sql 08-Apr-2004 12:42 12,305 Qfe469315.sql 08-Apr-2004 12:42 19,195 Qfe469571.sql 21-Jul-2004 08:31 1,105,167 Replmerg.sql 22-Jul-2004 15:00 2000.80.962.0 221,768 Replprov.dll 22-Jul-2004 15:00 2000.80.962.0 307,784 Replrec.dll 21-Jul-2004 08:39 2000.80.962.0 159,813 Replres.rll 10-Oct-2003 09:48 1,087,150 Replsys.sql 10-Oct-2003 09:48 986,603 Repltran.sql 22-Jul-2004 15:00 2000.80.962.0 287,304 Rinitcom.dll 22-Jul-2004 15:00 2000.80.962.0 78,416 Sdiclnt.dll 22-Jul-2004 15:00 2000.80.962.0 66,112 Semmap.dll 22-Jul-2004 15:00 2000.80.962.0 57,916 Semnt.dll 22-Jul-2004 15:00 2000.80.962.0 492,096 Semobj.dll 22-Jul-2004 14:12 2000.80.962.0 172,032 Semobj.rll 22-Jul-2004 14:59 2000.80.962.0 53,832 Snapshot.exe 13-Jul-2004 11:59 117,834 Sp3_serv_uni.sql 22-Jul-2004 14:59 2000.80.962.0 28,672 Sqlagent.dll 22-Jul-2004 14:59 2000.80.962.0 311,872 Sqlagent.exe 22-Jul-2004 14:59 2000.80.962.0 168,001 Sqlakw32.dll 22-Jul-2004 15:00 2000.80.962.0 33,344 Sqlctr80.dll 22-Jul-2004 15:00 2000.80.962.0 4,215,360 Sqldmo.dll 22-Jul-2004 14:59 25,172 Sqldumper.exe 21-Jul-2004 08:29 2000.80.962.0 28,672 Sqlevn70.rll 22-Jul-2004 14:59 2000.80.962.0 156,224 Sqlmaint.exe 22-Jul-2004 15:00 2000.80.962.0 180,792 Sqlmap70.dll 22-Jul-2004 15:00 2000.80.962.0 188,992 Sqlmmc.dll 22-Jul-2004 14:20 2000.80.962.0 479,232 Sqlmmc.rll 22-Jul-2004 15:00 2000.80.962.0 401,984 Sqlqry.dll 22-Jul-2004 15:00 2000.80.962.0 57,920 Sqlrepss.dll 22-Jul-2004 15:00 2000.80.962.0 7,581,777 Sqlservr.exe 22-Jul-2004 15:00 2000.80.962.0 590,396 Sqlsort.dll 22-Jul-2004 15:00 2000.80.962.0 45,644 Sqlvdi.dll 22-Jul-2004 15:00 2000.80.962.0 106,588 Sqsrvres.dll 22-Jul-2004 15:00 2000.80.962.0 33,340 Ssmslpcn.dll 22-Jul-2004 15:00 2000.80.962.0 82,492 Ssnetlib.dll 22-Jul-2004 15:00 2000.80.962.0 25,148 Ssnmpn70.dll 22-Jul-2004 15:00 2000.80.962.0 123,456 Stardds.dll 22-Jul-2004 15:00 2000.80.962.0 158,240 Svrnetcn.dll 22-Jul-2004 15:00 2000.80.962.0 76,416 Svrnetcn.exe 22-Jul-2004 15:00 2000.80.962.0 49,228 Ums.dll 22-Jul-2004 15:00 2000.80.962.0 98,872 Xpweb70.dll To work around this problem, in the GROUP BY clause, modify
the name of the first parameter for each user-defined function so that the
value of each first parameter remains unchanged, but the name of each first
parameter is different. To modify the name of the first parameter for each user-defined function, use one of the following examples.
STATUSMicrosoft
has confirmed that this is a problem in the Microsoft products that are listed
in the "Applies to" section. This problem was first corrected in Microsoft SQL Server 2000 Service Pack 4. MORE INFORMATIONTo reproduce this problem, run the following Transact-SQL
script: USE tempdb
GO
SET NOCOUNT ON
GO
DROP TABLE T1
GO
CREATE TABLE T1 (
c1 int NOT NULL,
c2 int NOT NULL,
c3 int NOT NULL
)
GO
INSERT INTO T1 VALUES ( 1, 2, 3 )
GO
DROP FUNCTION dbo.udf1
GO
CREATE FUNCTION dbo.udf1 ( @c1 int, @c2 int ) RETURNS int
AS
BEGIN
RETURN ( @c1 + @c2 )
END
GO
PRINT '*** This is correct.'
SELECT
dbo.udf1( c1, c2 ),
dbo.udf1( c3, c1 )
FROM T1 GROUP BY
dbo.udf1( c1, c2 ),
dbo.udf1( c3, c1 )
GO
PRINT '*** This is incorrect.'
PRINT '*** The value of 2nd column should be 4, not 3.'
SELECT
dbo.udf1( c1, c2 ),
dbo.udf1( c1, c3 )
FROM T1 GROUP BY
dbo.udf1( c1, c2 ),
dbo.udf1( c1, c3 )
GOREFERENCESFor a list of previous hotfixes, see the "Microsoft SQL
Server 2000 Post-Service Pack 3 or Microsoft SQL Server 2000 Post-Service Pack
3a hotfixes" section in the following Microsoft Knowledge Base article:
290211
(http://support.microsoft.com/kb/290211/
)
How to obtain the latest SQL Server 2000 service pack
For additional information
about the naming schema for Microsoft SQL Server updates, click the following
article number to view the article in the Microsoft Knowledge Base: 822499
(http://support.microsoft.com/kb/822499/
)
New naming schema for Microsoft SQL Server software update packages
For additional information about the
terminology that Microsoft uses when correcting software after it is released,
click the following article number to view the article in the Microsoft
Knowledge Base: 824684
(http://support.microsoft.com/kb/824684/
)
Description of the standard terminology that is used to describe Microsoft software updates
APPLIES TO
| Other Resources Other Support Sites
CommunityGet Help NowArticle Translations
|






Windows Live
Facebook
Twitter
Linkedin
Digg it
Yahoo
Delicious
StumbleUpon
Yammer
Reddit
Technorati
FriendFeed
Email
Back to the top
