My question is similar to this Get a list of dates between two dates using a function
using this code for 10 days recurring:
Declare @startDate datetime
Declare @endDate datetime
set @startDate= '03/01/2019 12:00:00'
set @endDate = '04/30/2019 12:00:00'
;WITH mycte AS
(
SELECT CAST(@startDate AS DATETIME) DateValue
UNION ALL
SELECT DateValue + 10
FROM mycte
WHERE DateValue + 10 < @endDate - 1
)
SELECT DateValue
FROM mycte
OPTION (MAXRECURSION 0)
I get the ff result:
2019-03-20 12:00:00.000
2019-03-30 12:00:00.000
2019-04-09 12:00:00.000
2019-04-19 12:00:00.000
but I want the result to be :
2019-03-20 12:00:00.000
2019-03-30 12:00:00.000
2019-03-31 12:00:00.000
2019-04-09 12:00:00.000
2019-04-10 12:00:00.000
2019-04-20 12:00:00.000
2019-04-21 12:00:00.000
2019-04-30 12:00:00.000
Is this possible with SQL?