Question

I have written a Stored procedure in which in given table column named xx can have 0,1 or null. When I give the below condition. SP is ignoring null and returning data only for 0 value.

WHERE (CAR_INSPECTION_NEW_TEST.NODAMAGEFLAG is null OR
       CAR_INSPECTION_NEW_TEST.NODAMAGEFLAG = 0) AND
       CAR_INSPECTION_NEW_TEST.ISSUBJECT_TODELIVER = 0

Can any one tell what is the problem?

Was it helpful?

Solution

By simple logic it will not return rows where NODAMAGEFLAG is null as long as ISSUBJECT_TODELIVER = 0 is not also valid (because of the AND).

So, check your data please.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top