I have been working on an SQL Statement in which I can select a start date and end date and add all the dates in between into the table. This start and end date is accompanied by an id. Like for example I select 1/1/2012 and 4/1/2012 and the id is 1
the result should be as follow
reqId reqDate
1 1/1/2012
1 2/1/2012
1 3/1/2012
1 4/1/2012
My sql statement is as follow
"Insert into Request(reqId, reqDate) " & _
"Select @request, reqDate From Request where reqDate between @start and @end "
It just does nothing so I am not sure if I am on the right track.
Not knowing what database system you’re using, here’s one for SQL Server (2008 or later):
Result:
(I originally said for 2005 or later, then realised I’m using
date. For 2005, replacedatewithdatetime)