ISNULL function in SQL Server

ISNULL function in SQL Server

ISNULL ( check_expression , replacement_value )

Replaces NULL with the specified replacement value. The value of check_expression is returned if it is not NULL; otherwise, replacement_value is returned after it is implicitly converted to the type of check_expression, if the types are different.

Example:

create table Tab(id int,name char(10))
insert into Tab values(1,’Vikas’)
insert into Tab values(2,null)
insert into Tab values(3,null)
insert into Tab values(4,’Arun’)
select * from Tab
select id,isnull(name,’No data’) as name from Tab

 

 

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply