Why does NULL = NULL evaluate to false in SQL server

前端 未结 19 1872
一向
一向 2020-11-22 05:02

In SQL server if you have nullParam=NULL in a where clause, it always evaluates to false. This is counterintuitive and has caused me many errors. I do understa

19条回答
  •  春和景丽
    2020-11-22 05:41

    Just an addition to other wonderful answers:

    AND: The result of true and unknown is unknown, false and unknown is false,
    while unknown and unknown is unknown.
    
    OR: The result of true or unknown is true, false or unknown is unknown, while unknown or unknown is unknown.
    
    NOT: The result of not unknown is unknown
    

提交回复
热议问题