I\'m looking for a query which will return me an extra column at the end of my current query which is the count of all columns within the return set which contain a null column.
select Col1, Col2,
case when Col1 is null then 1 else 0 end
+ case when Col2 is null then 1 else 0 end
as Col3
from (
select 'A' as Col1, 'B' as Col2
union select 'A', NULL
union select NULL, NULL
) z