Wednesday, May 14, 2014

TSQL (Transact-SQL) Tutorial: IS NULL Operator

The SQL Server (Transact-SQL) IS NULL condition is used to test for a NULL value.

expression IS NULL

If expression is a NULL value, the condition evaluates to TRUE. If expression is not a NULL value, the condition evaluates to FALSE.

Using - With where clause

So Let say we have multiple values in last name of employee are null and we want to get the list of those employee whose last name is null then we can write below query.

FROM employees
WHERE last_name IS NULL;

Expression =  null won’t behave like above is null condition it will return different results.

1 comment:

  1. I am writing a query Select 1 + NULL and it return me NULL instead of zero or 1.
    Can you please help with the reason ?

    Thank you