Article ID: 284440
Article Last Modified on 3/14/2006
APPLIES TO
- Microsoft SQL Server 7.0 Standard Edition
- Microsoft SQL Server 2000 Standard Edition
This article was previously published under Q284440
BUG #: 58247 (SQLBUG_70)
Bug #: 235592 (SHILOH_bugs)
SYMPTOMS
An UPDATE statement that modifies data by using a CASE statement and the NEWID function may report the following error message when running a DBCC CHECKTABLE function on the underlying table:
These error messages may occur only if all of the following conditions are true:
- The table has a data type of uniqueidentifier on one of the columns.
- The preceding column is updated with a CASE statement along with the NEWID function.
- There is a unique nonclustered index on the column with the uniqueidentifier datatype.
WORKAROUND
Avoid the use of a CASE statement in an UPDATE statement.
STATUS
Microsoft has confirmed this to be a problem in SQL Server 7.0. This problem has been corrected in U.S. Service Pack 3 for Microsoft SQL Server 7.0. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
274799 INF: How to Obtain Service Pack 3 for Microsoft SQL Server 7.0 and Microsoft Data Engine (MSDE) 1.0
For more information, contact your primary support provider.
Microsoft has confirmed that this is a problem in SQL Server 2000.
MORE INFORMATION
Steps to Reproduce Behavior
To reproduce the behavior, follow these steps:
use tempdb go drop table #t go create table #t(col1 uniqueidentifier DEFAULT (NewID()), CONSTRAINT main UNIQUE NONCLUSTERED (col1)) go insert into #t values (NewID()) go UPDATE #t set col1 = CASE WHEN 1=1 THEN NEWID() ELSE NULL end -- results in checktable errors -- set col1 = NEWID() -- doesn't result in the errors go dbcc traceon(3604) go dbcc checktable(#t) go
Keywords: kbbug kbfix kbsqlserv2000sp1fix KB284440