You could use a tally table to achieve this containing all the dates for the next n years. However you can achieve this in a single SELECT statement. The following code can deal with a date difference of 1000 days.DECLARE @d1 DATETIMEDECLARE @d2 DATETIMESET DATEFORMAT DMYSET @d1 = '15/1/2003'SET @d2 = '18/1/2003'SELECT DATEADD(d,units.n + (tens.n * 10) + (hundreds.n * 100),@d1) dteFROM (SELECT 0 n UNION SELECT 1 n UNION SELECT 2 n UNION SELECT 3 n UNION SELECT 4 n UNION SELECT 5 n UNION SELECT 6 n UNION SELECT 7 n UNION SELECT 8 n UNION SELECT 9 n) unitsCROSS JOIN (SELECT 0 n UNION SELECT 1 n UNION SELECT 2 n UNION SELECT 3 n UNION SELECT 4 n UNION SELECT 5 n UNION SELECT 6 n UNION SELECT 7 n UNION SELECT 8 n UNION SELECT 9 n) tensCROSS JOIN (SELECT 0 n UNION SELECT 1 n UNION SELECT 2 n UNION SELECT 3 n UNION SELECT 4 n UNION SELECT 5 n UNION SELECT 6 n UNION SELECT 7 n UNION SELECT 8 n UNION SELECT 9 n) hundredsWHERE DATEADD(d,units.n + (tens.n * 10) + (hundreds.n * 100),@d1) BETWEEN @d1 AND @d2
macka.--There are only 10 types of people in the world - Those who understand binary, and those who don't.