Collections:
NULL Values Involved in Boolean Operations in SQL Server
What Happens If NULL Values Are Involved in Boolean Operations in SQL Server Transact-SQL?
✍: FYIcenter.com
If NULL values are involved in Boolean operations, the result will vary depending on the operator type. For AND operator, FALSE takes precedence over NULL. The result can be summarized in a table below:
AND TRUE FALSE NULL TRUE true false null FALSE false false false NULL null false null
For OR operator, TRUE takes precedence over NULL. The result can be summarized in a table below:
OR TRUE FALSE NULL TRUE true true true FALSE true false null NULL true null null
The tutorial script below shows you that NULL AND FALSE returns FALSE:
IF 0=NULL AND 0=1 PRINT 'NULL AND FALSE returns TRUE' ELSE PRINT 'NULL AND FALSE does not returns TRUE' GO NULL AND FALSE does not returns TRUE IF NOT (0=NULL AND 0=1) PRINT 'NULL AND FALSE returns FALSE' ELSE PRINT 'NULL AND FALSE does not returns FALSE' GO NULL AND FALSE returns FALSE
⇒ "IS NULL" - Testing NULL Values in SQL Server
⇐ NULL Values Involved in Comparison Operations in SQL Server
2017-02-03, 3565🔥, 0💬
Popular Posts:
How To Generate CREATE VIEW Script on an Existing View in SQL Server? If you want to know how an exi...
What Happens to an Arithmetic Operation with Two Different Data Types in SQL Server Transact-SQL? Wh...
How To Get the Definition of a View Out of the SQL Server in SQL Server? If you want get the definit...
How To Break Query Output into Pages in MySQL? If you have a query that returns hundreds of rows, an...
How To Revise and Re-Run the Last SQL Command in Oracle? If executed a long SQL statement, found a m...