Let's say I have 2 columns:
Col1[tab][tab]Col2
111.11[tab][tab]5131351.00
44.64[tab][tab]NULL
NULL[tab][tab]8431.21
I realize that I can use COALESCE to replace the NULL values with zero, but why can't SQL Server figure that out on it's own, so I can simply write:
SELECT Col1 + Col2
instead of
SELECT COALESCE(Col1,0) + COALESCE(Col2,0)
Any thoughts? Is it a logical problem that there is no choice in, something the programmers left out?
Thanks for any references, thoughts on how the SQL engine parses NULLS in mathematical operations.
As a side note, I can't seem to get my columns in this post to line-up. If I used [tt] for monospace, it made no difference - it's automatically removing multiple spaces which I was using to line up the columns. When I add tabs, it at least gives a little breathing room, but I can't get the columns to align properly.
"But thanks be to God, which giveth us the victory through our Lord Jesus Christ." 1 Corinthians 15:57
Col1[tab][tab]Col2
111.11[tab][tab]5131351.00
44.64[tab][tab]NULL
NULL[tab][tab]8431.21
I realize that I can use COALESCE to replace the NULL values with zero, but why can't SQL Server figure that out on it's own, so I can simply write:
SELECT Col1 + Col2
instead of
SELECT COALESCE(Col1,0) + COALESCE(Col2,0)
Any thoughts? Is it a logical problem that there is no choice in, something the programmers left out?
Thanks for any references, thoughts on how the SQL engine parses NULLS in mathematical operations.
As a side note, I can't seem to get my columns in this post to line-up. If I used [tt] for monospace, it made no difference - it's automatically removing multiple spaces which I was using to line up the columns. When I add tabs, it at least gives a little breathing room, but I can't get the columns to align properly.
"But thanks be to God, which giveth us the victory through our Lord Jesus Christ." 1 Corinthians 15:57