DECLARE @Fromdate DATE = '01 Jan 2012'
,@Todate DATE = '30 Dec 2012'
,@Interval INT = 2
SELECT DateC , N
FROM ( SELECT DATEADD(DAY, N, @Fromdate ) AS DateC, N
FROM (SELECT (ROW_NUMBER() OVER (ORDER BY [object_id]) - 1) * (@Interval + 1)
FROM sys.columns) dt(N)
WHERE DateC <= @Todate
Note that I used sys.columns as in-run-time tally table. You may want to create and use proper tally table.
"The only true wisdom is in knowing you know nothing"
"O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
(So many miracle inventions provided by MS to us...)How to post your question to get the best and quick help