Microsoft KB Archive/133171

{|
 * width="100%"|

FIX: DocErr: Incorrect Regarding Comparison Operators w/ NULL

 * }

Q133171

-

The information in this article applies to:


 * Microsoft SQL Server versions 4.21a, 6.0

-

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, General Rules 1.a pg.169 states the following:

Let X and Y be any two corresponding .

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 Y' is unknown." Additional query words: Windows NT equals

Keywords : kbother

Issue type : kbbug

Technology : kbSQLServSearch kbAudDeveloper kbSQLServ600