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 |
|
sahu74
Posting Yak Master
100 Posts |
Posted - 2002-11-21 : 10:40:43
|
| This might be simple but I just cannot get to do this...I have a query in the formatSELECT a.total + b.total + c.totalFROM(SELECT ....)a,(SELECT ....)b,(SELECT ....)cThe output of 'a' and 'c' are numbers but the output of 'b' is null. So the result I get is 'NULL' although 'a' and 'c' are numbers. Can anyone help me with this please?PKS |
|
|
Lady
Starting Member
32 Posts |
Posted - 2002-11-21 : 10:44:54
|
| SET CONCAT_NULL_YIELDS_NULLWhen SET CONCAT_NULL_YIELDS_NULL is ON, concatenating a null value with a string yields a NULL result. For example, SELECT 'abc' + NULL yields NULL. When SET CONCAT_NULL_YIELDS_NULL is OFF, concatenating a null value with a string yields the string itself (the null value is treated as an empty string). For example, SELECT 'abc' + NULL yields abc.If not specified, the setting of the concat null yields null database option applies. |
 |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2002-11-21 : 10:52:22
|
| or (as you are working with numbers)SELECT coalesce(a.total,0) + coalesce(b.total,0) + coalesce(c.total,0)==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy.Edited by - nr on 11/21/2002 10:54:11 |
 |
|
|
Lady
Starting Member
32 Posts |
Posted - 2002-11-22 : 04:40:32
|
| isnull(a,'') + isnull(b,'') |
 |
|
|
|
|
|