Koen Verbeeck (12/20/2012)
Easy question. I didn't even had to check to 3rd query, because the second one gave (NULL,0) and there was only one answer in the list with that option 🙂The explanation however is wrong as pointed out by Ole Kristian. This works perfectly:
SELECT ISNULL(SUM(CONVERT(INT,NULL)),0) as sum_col1
, ISNULL(COUNT(CONVERT(INT,NULL)),0) as cnt_col1
FROM #TestAggregates
Furthermore, the explanation doesn't explain the results of the other two queries. But I guess those are self-explanatory if you read the BOL pages on COUNT and SUM.
+1