SQL Insert Given Date Range
Posted on 2010-01-04
I have a SQL table which has various columns, one of them is the date (date only) and the others are peoples movements for that date.
There are better ways of doing this I know, but this is the most straight forward one for the requirement I had, all I do is insert new movements for given people on a daily basis - and datestamping them with the applicable date
What I want to add now, is the next 1 years worth of dates automatically so that my SQL table will have 365 new rows, start with 04/01/2010 and incrementing 1 day at a time until it reaches a given date. (03/01/2011 in this case).
I know it can be done with 2 columns, one having start_date and another having end_date and SELECT WHERE BETWEEN but I don't want to change the existing structure of the table if possible as most people have their movements for each day.
Thanks in Advance