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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Replace NULL value with 0 after perform query

Author  Topic 

Delinda
Constraint Violating Yak Guru

315 Posts

Posted - 2008-11-27 : 21:58:37
Me using SQL Server 2000. My problem is when run SQL, have some resultset have NULL value.

Let's say, below is my table and some value

MsgDet
Profit (Datatype - money)
----------------------------
1.35
4.05
NULL
8.10
NULL
6.05
...

How SQL looks like to make it my resultset will display as follow

Profit
-------
1.35
4.05
0
8.10
0
6.05
...

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-11-28 : 02:22:50
Use COALESCE function.
Or ISNULL.



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-11-28 : 05:46:07
http://sqlblogcasts.com/blogs/madhivanan/archive/2007/10/04/isnull-or-coalesce.aspx
Go to Top of Page

wkm1925
Posting Yak Master

207 Posts

Posted - 2008-11-28 : 09:41:44
tq mr. visakh
Go to Top of Page

NeilG
Aged Yak Warrior

530 Posts

Posted - 2008-11-28 : 09:48:49
select isnull(Profit,0)as [Profit]
Go to Top of Page
   

- Advertisement -