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)
 Forcing addition inst4ead of concatenation

Author  Topic 

Bob
Starting Member

5 Posts

Posted - 2000-12-04 : 14:57:15
I'm relatively new to sql database and have run into a problem with null fields. I'm adding the result of a few subqueries that frequently return null values. Apparently SQL7 is treating this as a concatenation as whenever a null is returned, the result is null. Either that or addition with a null is still producing a null result?

Here's a simplified version of the query:
((select sum(X)...) + (select sum(Y)...)) as sumXY

So long as both X and Y are have a value, the query works as I expect it too. If either X or Y returns no rows, then apparently the result is null and then the sumXY is also null.

Perhaps there is something else going on here that I don't yet know about? Any insight will be greatly appreciated!




Bob
<><
   

- Advertisement -