How to Check for NULL value in a Query in SQL Server ?

Published on August 17, 2016 by abundantcode

Filed under SQL Server

Last modified August 17, 2016

Print this page

rate 1 star rate 2 star rate 3 star rate 4 star rate 5 star
Your rating: none, Average: 0 (0 votes)

This article have been viewed 300 times

You might want to check if a column contains a NULL value or NOT and filter the rows. You can use the IS NULL and IS NOT NULL keywords in SQL Server to perform the NULL check.

How to Check for NULL value in a Query in SQL Server ?

The NULL values cannot be easily identified using the = operator because the NULL refers to NO value. Using the IS NULL in SQL Server performs this NULL check to return true when the value of the column is NULL.

For example , if you want to retrieve the Employee records where the column organizationNode column contains NULL value , the query will be as follows.

use AdventureWorks2014
SELECT * FROM HumanResources.Employee
where OrganizationNode IS NULL

The output of the above query is


If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.

Leave a Comment


You might be Interested in these Posts

Displaying all the worksheet names in Excel using VBA Code

Do you want to display the names of the worksheets in the excel workbook ?. Here;s how you can do it...

How to change positive numbers to negative in Microsoft Excel 2016 ?

Do you want to change the positive numbers to negative numbers and vice versa (or in simple terms) ,...

How to convert number to text in Excel?

In Microsoft Excel 2016 , there are times when you don't want the numbers present in the cell to be ...