FIX: DocErr: Incorrect Regarding Comparison Operators w/ NULLLast reviewed: April 30, 1997Article ID: Q133171 |
The information in this article applies to:
SYMPTOMSOn page 368 of the Microsoft SQL Server version 4.2 "Transact-SQL Reference," it says that you can use the equal sign (=) character to check for a NULL value. However, this statement is misleading and should not be considered. The only reliable way to make comparisons with NULL values is to use the expression IS [NOT] NULL. There are two places in the documentation (TSQL Reference, pages 39 and 369) where it states that the equal sign character should not be used to compare NULL values. Inconsistencies may occur within stored procedures that use =NULL or !=NULL because the use of the equal sign in evaluation of NULL values is not precisely defined.
STATUSMicrosoft has confirmed this to be a problem in the documentation for Microsoft SQL Server version 4.21a. This problem was corrected in SQL Server version 6.0.
MORE INFORMATIONAn inconsistency problem stems from using the following syntax in a SELECT statement within a stored procedure:
WHERE col = NULLANSI X3.135-1992, Section 8.2 <comparison predicates>, General Rules 1.a pg.169 states the following:
Let X and Y be any two corresponding <row value constructor elements>. Let XV and YV be the values represented by X and Y respectively. Case: a) If XV or YV is the NULL value, then 'X <comparison operator> Y' is unknown." |
Additional query words: Windows NT equals
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |