SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 NULL = 0.00
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

peace
Constraint Violating Yak Guru

279 Posts

Posted - 04/15/2012 :  22:14:20  Show Profile  Reply with Quote
How to print the output if total amount is NULL, output should be 0.00

Else those which has amount, output print the amount.

khtan
In (Som, Ni, Yak)

Singapore
16746 Posts

Posted - 04/15/2012 :  22:35:17  Show Profile  Reply with Quote

ISNULL ( <column> , 0)
or
COALESCE ( <column> , 0)



KH
Time is always against us

Go to Top of Page

peace
Constraint Violating Yak Guru

279 Posts

Posted - 04/15/2012 :  22:47:08  Show Profile  Reply with Quote
Thanks.

I was thinking to use case when...

This is more usefull.

Thanks
Go to Top of Page

khtan
In (Som, Ni, Yak)

Singapore
16746 Posts

Posted - 04/15/2012 :  23:05:35  Show Profile  Reply with Quote
you can also use CASE WHEN . . .
CASE WHEN <column> IS NULL THEN 0 ELSE <column> END




KH
Time is always against us

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
47157 Posts

Posted - 04/16/2012 :  12:12:26  Show Profile  Reply with Quote
quote:
Originally posted by peace

Thanks.

I was thinking to use case when...

This is more usefull.

Thanks


COALESCE is equivalent to the CASE..WHEN internally

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000