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.
Author |
Topic |
zurbum
Yak Posting Veteran
55 Posts |
Posted - 2004-11-12 : 13:49:27
|
I want to convert NULL to 0 money, is this possible?Imagine to have 2 tables, DEPOSIT and WITHDRAWIf I want to know, how much money a person has on account I would doSELECT (SELECT SUM(MON) FROM DEPOSIT WHERE ID=1) - (SELECT SUM(MON) FROM WITHDRAW WHERE ID=1)But if there isn't any record in WITHDRAW table, the result is NULL.How to avoid this in the easiest way? |
|
dsdeming
479 Posts |
Posted - 2004-11-12 : 13:55:01
|
See ISNULL or COALESCE in BOL.Dennis |
|
|
zurbum
Yak Posting Veteran
55 Posts |
Posted - 2004-11-12 : 14:11:52
|
Great, ISNULL has done its work.Thank you Dennis. |
|
|
rockmoose
SQL Natt Alfen
3279 Posts |
Posted - 2004-11-12 : 17:08:55
|
COALESCE is SQL Standard, ISNULL is TSQL extension.rockmoose |
|
|
|
|
|