日期:2014-05-17 浏览次数:20646 次
declare @startdate datetime='2013-11-07 10:10:00'
declare @incre int =35;
declare @preDate datetime;
declare @i int=0;
if object_id('tempdb..#t') is not null drop table #t;
create table #t(id int,EventDate datetime)
set @preDate=@startdate;
while ( @i<100)
begin
if datepart(hour,dateadd(minute,@incre,@preDate))*100+datepart(minute,dateadd(minute,@incre,@preDate)) between 1201 and 1329
begin
insert into #t values(@i+1,dateadd(minute,@incre+90,@preDate));
set @preDate=dateadd(minute,@incre+90,@preDate)
end
else if datepart(hour,dateadd(minute,@incre,@preDate))*100+datepart(minute,dateadd(minute,@incre,@preDate)) between 1731 and 1829
begin
insert into #t values(@i+1,dateadd(minute,@incre+60,@preDate));
set @preDate=dateadd(minute,