Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Null behaviour on SQL 2008

$
0
0

Sorry guys, is there anyone who can explain me the null behaviour on SQL 2008? I mean, I got this select

select customername, contract, CONVERT(varchar(6),settlementdate,112) as per, sum(consumption) as
weight, SUM(gp2) as gp, SUM(tot) as abp, SUM(ccost) as ccost,  
from big15 group by customername, contract, CONVERT(varchar(6),settlementdate,112)                                                                                                                               

That retrieves me

Warning: Null value is eliminated by an aggregate or other SET operation.

(22118 row(s) affected)

Now I'm wondering, what means? That it has considered the null as zero value? Or that it has truncate or dropped the rows cointaning a null value? It's something I lost in my brain.

And in this case:

select customername, contractid, CONVERT(varchar(6),settlementdate,112) as per,   gp,  abp,  ccost,  RcCost,
(gp + abp + ccost + rccost) as tot                 

 

That return null if there is a null value. NowI am going to try Isnull or Coalesce but what concern me is the first question. In a sum column what is the rule on SQL. Zero or drop ( don't consider) the row?

Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>