SHOW ALL Dates data between two dates; if no row exists for particular date then show zero in all columns
;with d(date) as ( select cast(’10/01/2012′ as datetime) union all select date+1 from d where date < ’10/15/2012′ ) select t.ID, d.date CDate, isnull(t.val, 0) val from d left join temp t on t.CDate = d.date order by d.date OPTION (MAXRECURSION 0) — use this if your dates are >99 days apart You need to … Read more