title: SQL Server 2008 Generate a Series of date times
body: <p>I am trying to generate a table with a series of date times in it.</p>
  
  <p>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. </p>
  
  <p>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 </p>
  
  <pre><code>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))
  </code></pre>
  
  <p>this becomes very tedious.. especially when the end date time is <code>2011-07-20 15:37:34</code>
  there are a lot of insert statements to make :(</p>