Friday, May 10, 2013

isnull function in sql server

Replaces NULL with the specified replacement value.

Syntax :

ISNULL ( check_expression , replacement_value )


Example  :
                    If any Parameter has null value ,you can replace with specified value.
                  
-------------------CREATE Table --------------
create table testtable
(
  amount int null
)

---------------------Now inset null value in table------------------
insert into testtable
select null
--------------This table now return null value--------------------
select amount from testtable
-----------Output
---  NULL

--------------Now using ISNULL function-replace Null value to 0---------------

select isnull(amount,0)

-------------------After Using ISNULL function output is  0

drop table testtable

If you are searching life partner. your searching end with kpmarriage.com. now kpmarriage.com offer free matrimonial website which offer free message, free chat, free view contact information. so register here : kpmarriage.com- Free matrimonial website

0 comments:

Post a Comment