SQL Syntax - The important of accuracy
A colleague recently pointed out a great article about the difference between “IS NULL” and “= NULL” over at http://www.sqlservercentral.com.
Often small details in syntax can be overlooked causing unintended results or nonfunctional code. It’s very important when working with any language that you consult available help documentation whenever necessary.
Any developer who works with SQL will want to understand the important differences between “IS NULL” and “= NULL”.
“= NULL” is an expression of value. Meaning, if the variable has been set and memory created for the storage of data it has a value. A variable can in fact be set to NULL which means the data value of the objects is unknown.
Now “IS NULL” is a little trickier and is the preferred method for evaluating the condition of a variable being NULL. When you use the “IS NULL” clause, it checks both the address of the variable and the data within the variable as being unknown.
Click here to see the full article to better understand the difference between IS NULL and = NULL.
