I thought the simple query below would let me convert a Null to a 0, but it doesn't do the conversion. I have a bunch of Null results everywhere.
SELECT *
FROM (SELECT [Level 1], [Level 2], [Level 3], Headcount, IsNull([ME],0) AS ME
FROM Personnel_Raw)
SCR
PIVOT
(SUM(Headcount) FOR ME IN (ME1, ME2, ME3, ME4, ME5, ME6, ME7, ME8, ME9, ME10, ME11, ME12, ME13, ME14, ME15))
PIV;
I guess the IsNull is not firing. Or, maybe it's converted into a 0 and then converted back into a Null.