IS NULL in SQL

HOW TO USE ISNULL FUNCTION IN SQL SERVER?

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


Posted

in

Tags:

Comments

Leave a Reply