[thelist] (SQL2k) NULL and LIKE

Tab Alleman Tab.Alleman at MetroGuide.com
Wed Dec 10 10:07:31 CST 2003


I don't get it.  

If I do this query:

SELECT Browser FROM xmlErrorLog 
WHERE (TimeStamp BETWEEN '12/10/2003 00:00' AND '12/10/2003 23:59') 
AND (NOT (ClientIP LIKE '10.1.%')) 
AND (NOT (ClientIP LIKE '192.168.%')) 

I get 2 rows:
NULL
NULL

But if I modify the query thus:

SELECT Browser FROM xmlErrorLog WHERE (TimeStamp BETWEEN '12/10/2003
00:00' AND '12/10/2003 23:59') 
AND (NOT (ClientIP LIKE '10.1.%')) 
AND (NOT (ClientIP LIKE '192.168.%')) 
AND (NOT (Browser LIKE '%RedAlert%')) -- this is the only change

I get no rows.

So, NULL is LIKE '%RedAlert%'???  How so?  Is this expected behavior?


More information about the thelist mailing list