How to create a row for every day in a date range using a stored procedure
DECLARE @StartDate datetime = MIN(DATEFROMPARTS(1753, 1, 1)) ,@EndDate datetime = MAX(DATEFROMPARTS(9999, 12, 30)) ; WITH theDates AS (SELECT @StartDate as theDate UNION ALL SELECT DATEADD(day, 1, theDate) FROM theDates WHERE DATEADD(day, 1, theDate) <= @EndDate ) SELECT theDate, 1 as theValue FROM theDates OPTION (MAXRECURSION 0) ;