Article ID: 281338 - Last Review: March 14, 2006 - Revision: 2.1

FIX: Select Distinct Fails to Eliminate Duplicate Null Values on Bit Datatype

This article was previously published under Q281338
BUG #: 26147 (SQLBUG_70)
Expand all | Collapse all

SYMPTOMS

Select distinct does not eliminate duplicate null values that are contained in bit datatype columns.

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  (http://support.microsoft.com/kb/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.

MORE INFORMATION

Use the code that follows to reproduce this behavior:
create table #myTable( bar bit)
go
insert into #mytable values (1)
insert into #mytable values (1)
insert into #mytable values (NULL)
insert into #mytable values (NULL)
go
select distinct bar from #mytable
go
				
The preceding code returns this result:
bar  
---- 
NULL
NULL
1
				
Note that the code correctly eliminates the duplicate value 1 but incorrectly returns duplicate null values. The correct resultset is:
bar  
---- 
NULL
1
				

APPLIES TO
  • Microsoft SQL Server 7.0 Standard Edition
Keywords: 
kbbug kbfix KB281338
 

Article Translations

 

Related Support Centers