Here
in this article I am going to explain COALESCE function of sql server with example.
Description:
The
COALESCE function takes comma separated list of arguments of same data type sbut
returns the value of the first non-NULL argument.
Syntax:
COALESCE( expression1,[....n] )
Example:
I
have created a table Employee and insert some dummy data into it.
Now you can see in last 2 record status of employee is null. I want to
replace null with 0. Run the below given query and check output.
select name,COALESCE(Status,0) as 'status' from Employee
Output:
No comments:
Post a Comment