DECLARE @startdate CHAR(8), @numberDays TINYINT
SET @startdate = '20160101'
SET @numberDays = 10;
WITH CTE_DatesTable
AS
(
SELECT CAST(@startdate as date) AS [date]
UNION ALL
SELECT DATEADD(dd, 1, [date])
FROM CTE_DatesTable
WHERE DATEADD(dd, 1, [date]) <= DateAdd(DAY, @nu...