DECLARE @mindate DATETIME; DECLARE @maxdate DATETIME; SET @mindate = DATEADD(MONTH, -11, GETDATE()); SET @maxdate = GETDATE(); WITH temptab ( date ) AS ( SELECT @mindate UNION ALL SELECT DATEADD(m, 1, temptab.date) AS date FROM temptab WHERE DATEADD(m, 1, temptab.date) <= @maxdate ) SELECT * FROM temptab;