how to Replace null value with 0 in sql server 2008

08:31 Sumit Shekhawat 0 Comments


Replace null value with 0 in sql server 2008


Summary : how to a null value convert into 0.


solution : ISNULL ( check_expression , replacement_value )

declare @a float;
set @a  = ISNULL((select SUM(CONVERT(FLOAT,quentity)) as qty  from Cutting 
                   WHERE jobno = '1' and contractorname = 'submit'),0)


-- here when quentity is null then it is return "0" else your calculate value;


Thank You

[Sumit Singh Shekhawat]

0 comments: