Search code examples
sqlsql-servernullwhere-clause

How to use NULL or empty string in SQL


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.


Solution

  • Select *
    From Table
    Where (col is null or col = '')
    

    Or

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