HOW TO USE ISNULL FUNCTION IN SQL SERVER

IS NULL in SQL

ISNULL(), SQL Server function returns an alternative value when an expression is NULL.

Syntax of ISNULL() in SQL-

ISNULL(<column_name>,<alternative_value>)

Example of ISNULL() in SQL Server query-

SELECT ProductName,

(UnitsInStock + ISNULL(UnitsOnOrder,0)

FROM Products;

–It will return an alternative value ‘0’ when an expression is NULL


Leave a Reply

Your email address will not be published. Required fields are marked *