• As KENT suggested, it will be easier for you if you have a permanent Calendar TABLE insted of TEMP Table.

    the link KENT provided is all you need and adding to it : http://omnibuzz-sql.blogspot.com/2006/07/generating-temporary-calendar-tables.html