This behavior is not specific to SQL Server. All standards-compliant . To provide a check for NULL values, isNull function is provided. Moreover, you can use the IS operator as you used in the third query. Hope this helps. It does the same amount of reads () as the OR query, but . I'm not going to re-post the query plan and stats info -- they really didn't. SQL IS NULL Clause. NULL is a special value that signifies 'no value'. Comparing a column to NULL using the = operator is undefined. Instead, use WHERE IS.
A field with a NULL value is one that has been left blank during record creation! We will have to use the IS NULL and IS NOT NULL operators instead. The statement is no longer trying to compare NULL with NULL, but . If we're not familiar with ISNULL in SQL Server or are transitioning in. Determines whether or not a given expression is NULL. Note. ISNULL() is not a supported function in SQL Server Compact.
Please help improve SQL Server docs! Replaces NULL Transact-SQL Syntax Conventions The value of check_expression is returned if it is not NULL; otherwise, F. Using IS NULL to test for NULL in a WHERE clause. You would use Is Null and Is Not Null in query expressions and SQL WHERE clauses. IsNull(), on the other hand, is a Visual Basic for. And not only is NULL not equal to anything, it is not LIKE anything functions ( e.g. ISNULL()) in your WHERE clause, and better options exist. This SQL Server tutorial explains how to use the IS NOT NULL condition in SQL Server (Transact-SQL) with syntax and examples. The SQL Server.