FIX: Query Containing LIKE NULL May Not Return Correct Results (308370)



The information in this article applies to:

  • Microsoft SQL Server 2000 (all editions)

This article was previously published under Q308370
BUG #: 355085 (SHILOH_BUGS)

SYMPTOMS

When you run a query containing LIKE NULL as one of the OR operands, the query may return no results even though there are rows satisfying other OR predicates. For example:
SELECT * FROM pubs.dbo.authors
  WHERE au_lname = 'White' OR
        au_fname like NULL
				

RESOLUTION

To resolve this problem, obtain the latest service pack for Microsoft SQL Server 2000. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

290211 INF: How to Obtain the Latest SQL Server 2000 Service Pack

WORKAROUND

Replace LIKE NULL with IS NULL.

STATUS

Microsoft has confirmed that this is a problem in Microsoft SQL Server 2000. This problem was first corrected in Microsoft SQL Server 2000 Service Pack 2.

Modification Type:MajorLast Reviewed:10/16/2003
Keywords:kbbug kbfix kbSQLServ2000preSP2Fix KB308370