I have found this solution, but it is limited to 2047 days.
DECLARE @MinDate DATE, @MaxDate DATE;
SELECT DATEADD(DAY,number,@MinDate) [Date]
FROM master.dbo.spt_values
WHERE type = 'P'
AND number > 0
AND DATEADD(DAY,number,@MinDate) <= @MaxDate
How can i extend maximum days count ?
Please try using CTE: