ISNULL function in SQL Server

Category: SQL Comments: No comments


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

 

 

Leave a Reply

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

*

HTML tags are not allowed.