sql server - ISNULL erroneous return? -
i have following query:
select apps.field4, isnull(apps.field4, '-1') applications apps apps.object_id = 1727847 , isnull(apps.field4, -1) = -1 apps.field4 integer, , no record has value less 0 field4.
the return values above query are:
+------+----+ | null | -1 | +------+----+ but if add and apps.field4 null clause, no records returned:
select apps.field4, isnull(apps.field4, '-1') applications apps apps.object_id = 1727847 , apps.field4 null , isnull(apps.field4, -1) = -1 why isnull seem correctly identify null value, is null not?
i know i'm not answering question. however, found interesting in msdn :
c. testing null in where clause not use isnull find null values. use is null instead. following example finds products have null in weight column. note space between is , null.
use adventureworks2012; go select name, weight production.product weight null; go
Comments
Post a Comment