Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 NULL = 0.00

Author  Topic 

peace
Constraint Violating Yak Guru

420 Posts

Posted - 2012-04-15 : 22:14:20
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)

17689 Posts

Posted - 2012-04-15 : 22:35:17
[code]
ISNULL ( <column> , 0)
or
COALESCE ( <column> , 0)
[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

peace
Constraint Violating Yak Guru

420 Posts

Posted - 2012-04-15 : 22:47:08
Thanks.

I was thinking to use case when...

This is more usefull.

Thanks
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

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




KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-04-16 : 12:12:26
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
   

- Advertisement -