I am trying to generate a table with a series of date times in it.
I have the specified start date time and end date time(end date time is end of sequence), I add a time interval ~ (this can vary) to the start date time in seconds and this gives me the end date time.
The next sequence uses the end date time as its start value and adds the time interval in seconds to it. To demonstrate output I need. Is there a quick way to create such a table, other than using a lot of insert into commands?, I am really stumped
StartTime Endtime Duration
2011-07-20 11:00:33 2011-07-20 11:09:47 554
2011-07-20 11:09:47 2011-07-20 11:19:01 554
declare @StartTime datetime = '2011-07-20 11:00:33',
@EndTime datetime = '2011-07-20 15:37:34'
@Interval int = 554 -- this can be changed.
insert into tmp_IRange
values('2011-07-20 11:00:33', DATEADD(SECONDS, @Duration, 2011-07-20 11:00:33))
this becomes very tedious.. especially when the end date time is 2011-07-20 15:37:34
there are a lot of insert statements to make :(