Working with NULLS
A NULL value represents the absence of data or, in other words, data that is missing or unknown. When coding queries, stored procedures, or any other T-SQL, it is important to keep in mind the nullability of data because it will affect many aspects of your logic. For example, the default result of most operators (such as, +, -, AND, and OR) is NULL when either operand is NULL.
- NULL + 10 = NULL
- NULL AND TRUE = NULL
- NULL OR FALSE = NULL
The exception occurs when using the OR operator in a NULL OR TRUE test. Since one side of the equation is TRUE, the OR operator will return TRUE even if the other ...