I'm confused. The BOL & referenced link shows:
To me this says that if you combine False & Unknown you get Unknown. How can it mean it returns false?
Does anyone have an example?
You need to look at the header of the table also. UNKNOWN (in bold on the left) is being compared to 3 different values in the top row. The intersection of the row and the column give the result.
TRUE
FALSE
UNKNOWN
When UNKNOWN is compared to FALSE with the AND operator, the result is FALSE (in red).
Stephen,
Your CASE statement results might more accurately be given as
DECLARE @a INT, @b INTSET @a = 0SELECT CASE WHEN (@a = 1 /*FALSE*/ AND @b = 1 /*UNKNOWN*/) THEN 'TRUE' ELSE 'NOT TRUE' END
The statement shows that the result of the AND operation is NOT TRUE, but it does not tell you whether it is FALSE or UNKNOWN. That's where basic logic is important in order to understand SQL Server results. =)