Yeah, look at the CTE: It only generates 1000 n's. It's good to understand it fully. You can just add:,base b3, base b4, base b5, base b6
to the endHere's an enhanced version to look at:declare @startDate datetime = '2013-01-01 00:00:00.000';declare @endDate datetime = '2016-01-01 00:00:00.000';declare @intervals int = datediff(day, @startdate, @enddate)*12*24-1;with base(n) as ( select n from (values (1),(1),(1),(1),(1),(1),(1),(1),(1),(1) ) v(n) ), N(n) as ( select 1 from base b0, base b1, base b2, base b3, base b4, base b5, base b6 ), numDates(n) as ( select top (@intervals) ROW_NUMBER() over (order by (select null)) from N )--insert into mytable (Startdate, Enddate)select dateadd(minute, 5*(n-1), @startdate) as Startdate , dateadd(minute, 5*n, @startdate) as Enddate from numDatesorder by n;