FIX: You may receive different date values for each row when you use the getdate function within a case statement in SQL Server 2005 (925153)



The information in this article applies to:

  • Microsoft SQL Server 2005 Enterprise Edition
  • Microsoft SQL Server 2005 Enterprise Edition for Itanium Based Systems
  • Microsoft SQL Server 2005 Enterprise X64 Edition
  • Microsoft SQL Server 2005 Standard X64 Edition
  • Microsoft SQL Server 2005 Workgroup
  • Microsoft SQL Server 2005 Standard Edition

Bug: #50000210 (SQL Hotfix)
Microsoft distributes Microsoft SQL Server 2005 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 2005 fix release.

SUMMARY

This article describes the following about this hotfix release:
  • The issues that are fixed by this hotfix package
  • The prerequisites for applying the hotfix package
  • Information whether you must restart the computer after you apply the hotfix package
  • Information whether the hotfix package is replaced by any other hotfix package
  • Information whether you must make any registry changes after you apply the hotfix package
  • The files that are contained in the hotfix package

SYMPTOMS

When you use the getdate function in a select query in Microsoft SQL Server 2005, you may receive different date values for each row. You experience this problem when you use the getdate function within a case statement.

Note You may not experience this problem in Microsoft SQL Server 2000.

RESOLUTION

A supported hotfix is now available from Microsoft, but it is only intended to correct the problem that is described in this article. Only apply it to systems that are experiencing this specific problem. This hotfix may receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next SQL Server 2005 service pack that contains this hotfix.

To resolve this problem immediately, contact Microsoft Product Support Services to obtain the hotfix. For a complete list of Microsoft Product Support Services telephone numbers and information about support costs, visit the following Microsoft Web site:Note In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question.You must have

Prerequisites

You must have Microsoft SQL Server 2005 Service Pack 1 (SP1) installed to apply this hotfix.

For more information about how to obtain SQL Server 2005 Service Pack 1, click the following article number to view the article in the Microsoft Knowledge Base:

913089 How to obtain the latest service pack for SQL Server 2005

Restart information

You do not have to restart the computer after you apply this hotfix.

Registry information

You do not have to change the registry.

Hotfix file information

This 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 item in Control Panel.SQL Server 2005, 32-bit x86 versions
File nameFile versionFile sizeDateTimePlatform
logread.exe2005.90.2189.0398,11207-Sep-200622:14x86
microsoft.analysisservices.adomdclient.dll9.0.2189.0543,52007-Sep-200622:14x86
microsoft.analysisservices.deploymentengine.dll9.0.2189.0138,01607-Sep-200622:14x86
microsoft.analysisservices.dll9.0.2189.01,215,26407-Sep-200622:14x86
microsoft.sqlserver.mgdsqldumper.dll2005.90.2189.075,55207-Sep-200622:12x86
microsoft.sqlserver.sqlenum.dll9.0.2189.0908,06407-Sep-200622:14x86
msgprox.dll2005.90.2189.0197,92007-Sep-200622:12x86
msmdlocal.dll9.0.2189.015,610,14407-Sep-200622:14x86
msmdredir.dll9.0.2189.03,990,30407-Sep-200622:15x86
replprov.dll2005.90.2189.0547,61607-Sep-200622:14x86
replrec.dll2005.90.2189.0782,11207-Sep-200622:14x86
sqlaccess.dll2005.90.2189.0347,93607-Sep-200622:14x86
sqlagent90.exe2005.90.2189.0319,26407-Sep-200622:13x86
sqlservr.exe2005.90.2189.028,962,13607-Sep-200622:14x86
xpstar90.dll2005.90.2189.0292,64007-Sep-200622:17x86
xpstar90.rll2005.90.2189.0152,86407-Sep-200622:14x86
SQL Server 2005, 64-bit version
File nameFile versionFile sizeDateTimePlatform
logread.exe2005.90.2189.0522,52808-Sep-200603:51x64
microsoft.analysisservices.adomdclient.dll9.0.2189.0543,52007-Sep-200622:14x86
microsoft.analysisservices.adomdclient.dll9.0.2189.0543,52008-Sep-200603:51x86
microsoft.analysisservices.deploymentengine.dll9.0.2189.0138,01607-Sep-200622:14x86
microsoft.analysisservices.dll9.0.2189.01,215,26407-Sep-200622:14x86
microsoft.sqlserver.mgdsqldumper.dll2005.90.2189.075,55207-Sep-200622:12x86
microsoft.sqlserver.mgdsqldumper.dll2005.90.2189.091,42408-Sep-200603:48x64
microsoft.sqlserver.sqlenum.dll9.0.2189.0875,29608-Sep-200603:48x86
msgprox.dll2005.90.2189.0259,36008-Sep-200603:50x64
msmdlocal.dll9.0.2189.015,610,14407-Sep-200622:14x86
msmdredir.dll9.0.2189.03,990,30407-Sep-200622:15x86
replprov.dll2005.90.2189.0745,24808-Sep-200603:48x64
replrec.dll2005.90.2189.01,008,41608-Sep-200603:48x64
sqlaccess.dll2005.90.2189.0355,10408-Sep-200603:51x86
sqlagent90.exe2005.90.2189.0390,94408-Sep-200603:51x64
sqlservr.exe2005.90.2189.039,323,42408-Sep-200603:48x64
xpstar90.dll2005.90.2189.0540,96008-Sep-200603:51x64
xpstar90.rll2005.90.2189.0153,37608-Sep-200603:49x64
SQL Server 2005, Itanium architecture version
File nameFile versionFile sizeDateTimePlatform
logread.exe2005.90.2189.01,095,45608-Sep-200602:51IA-64
microsoft.analysisservices.adomdclient.dll9.0.2189.0543,52007-Sep-200622:14x86
microsoft.analysisservices.adomdclient.dll9.0.2189.0543,52008-Sep-200602:50x86
microsoft.analysisservices.deploymentengine.dll9.0.2189.0138,01607-Sep-200622:14x86
microsoft.analysisservices.dll9.0.2189.01,215,26407-Sep-200622:14x86
microsoft.sqlserver.mgdsqldumper.dll2005.90.2189.075,55207-Sep-200622:12x86
microsoft.sqlserver.mgdsqldumper.dll2005.90.2189.0163,10408-Sep-200602:49IA-64
microsoft.sqlserver.sqlenum.dll9.0.2189.0875,29608-Sep-200602:51x86
msgprox.dll2005.90.2189.0542,49608-Sep-200602:50IA-64
msmdlocal.dll9.0.2189.048,587,04008-Sep-200602:49IA-64
msmdredir.dll9.0.2189.06,237,47208-Sep-200602:52IA-64
replprov.dll2005.90.2189.01,617,18408-Sep-200602:51IA-64
replrec.dll2005.90.2189.02,141,47208-Sep-200602:51IA-64
sqlaccess.dll2005.90.2189.0349,47208-Sep-200602:50x86
sqlagent90.exe2005.90.2189.01,143,58408-Sep-200602:51IA-64
sqlservr.exe2005.90.2189.072,232,22408-Sep-200602:50IA-64
xpstar90.dll2005.90.2189.0951,07208-Sep-200602:53IA-64
xpstar90.rll2005.90.2189.0152,35208-Sep-200602:49IA-64

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

MORE INFORMATION

For more information, click the following article number to view the article in the Microsoft Knowledge Base:

824684 Description of the standard terminology that is used to describe Microsoft software updates

Steps to reproduce the problem

Run the following code example in SQL Server 2005.
Use <Database>
go
drop table temp_table
go

create table temp_table (a int, b char(100), c char(1))
go
set nocount on
go
declare @ret int
set @ret = 0
while (@ret < 10000)
begin
      set @ret = @ret + 1
      insert into temp_table values(@ret,@ret,'A')
      insert into temp_table values(@ret*2,@ret*2,'B')
      insert into temp_table values(@ret*3,@ret*3,'C')
      insert into temp_table values(@ret*4,@ret*4,'D')
end
go

select case
      when c = 'A'
            then getdate()
      when c = 'B'
            then getdate()
      when c = 'D' 
            then getdate()
      end as Status,getdate(),a,b,c
from temp_table order by A
Note Replace <Database> with the database name.

Modification Type:MajorLast Reviewed:9/22/2006
Keywords:kbsql2005tsql kbExpertiseAdvanced kbQFE kbhotfixserver kbpubtypekc KB925153 kbAudDeveloper kbAudITPRO