I have this table:
**ID StartDate EndDate**
1 01/01/2012 03/01/2012
2 28/09/2013 02/10/2013
3 12/06/2011 15/06/2011
And I need to have this table: Date
**ID Date**
1 01/01/2012
1 02/01/2012
1 03/01/2012
2 28/09/2013
2 29/09/2013
2 30/09/2013
2 01/10/2013
2 02/10/2013
3 12/06/2011
3 13/06/2011
3 14/06/2011
3 15/06/2011
I Have Next Sql Code That Retarn The Dates Between The StartDate & The EndDate + StartDate +EndDate :
declare @Start datetime
declare @end datetime
declare @request int
set @Start = '2014-09-28 06:53:04.560'
set @end = '2014-09-29 11:53:04.560'
set @request = 1
;with Dates as (
select @request as reqId,@Start as reqDate
union all
select reqId+1,DATEADD(hh,1,reqDate) from Dates
where reqDate < @end
)
select * from Dates
How Can I Get This Result For A Bulk Of StartDate-EndDate Input?