FIX: DocErr: Incorrect Regarding Comparison Operators w/ NULL

Last reviewed: April 30, 1997
Article ID: Q133171
The information in this article applies to:
  • Microsoft SQL Server, versions 4.21a and 6.0
BUG# NT: 9191 (4.21a)

SYMPTOMS

On 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.

STATUS

Microsoft 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 INFORMATION

An inconsistency problem stems from using the following syntax in a SELECT statement within a stored procedure:

   WHERE col = NULL

ANSI 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
Keywords : kbbug4.21a kbfix6.00 kbother SSrvDoc_Err SSrvStProc
Version : 4.21a 6.0
Platform : WINDOWS
Issue type : kbdocerr


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: April 30, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.