I have a question that we always say that null =null is false ,I want to know that when the ansi_nulls is off this statement which is “null=null” is also false? thanks
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
With
ANSI_NULLS OFF,NULL = NULLevaluates toTRUE.With
ANSI_NULLS ON(the default),NULL = NULLevaluates toNULL.NULL IS NULLalways evaluates toTRUE.However, in MySQL, you cannot turn off ANSI_NULLS. You are probably thinking of MS SQL Server.
Future versions of MS SQL Server won’t support
ANSI_NULLS OFF, so I wouldn’t use it.You should leave
ANSI_NULLS ONand useIS NULLto evaluate if something IS NULL.If you’re having problems remembering how NULL works by default (ANSI_NULLS ON), you should think of NULL as “unknown“. For example, if there are two strangers in the room, their names are NULL. If your query is, “Are their names the same?” Your answer IS NULL.
Now, let’s say Bob is in the room with just one stranger, whose name IS NULL. Again the answer to your query “Are their names the same?” IS NULL. Note that if you compare anything to NULL, your answer IS NULL.