How to use NULL or empty string in SQL

poshan picture poshan · Mar 27, 2013 · Viewed 607.8k times · Source

I would like to know how to use NULL and an empty string at the same time in a WHERE clause in SQL Server. I need to find records that have either null values or an empty string. Thanks.

Answer

codingbadger picture codingbadger · Mar 27, 2013
Select *
From Table
Where (col is null or col = '')

Or

Select *
From Table
Where IsNull(col, '') = ''