Thursday, 24 March 2016

What is ISNULL function in SQL Server ?

Syntax : 
ISNULL (ColumnName,Repalcement Value)


Example :
Select IsNull(FirstName,LastName) from EmployeeDetail

In EmployeeDetail table the FirstName and LastName are Nullable columns.
If the FirstName column is null ,we can get the value of LastName column using Isnull function.

In above example ,the select query will display the LastName of all employees unless the firstname column value is null.

It is possible to use the  isnull function in both "select statement" as well as "where" condition.

No comments:

Post a Comment