循环写入一个月的每一天日期

declare @stime datetime;
declare @etime datetime
set @stime ='2015-01-01'
set @etime='2015-02-01'
insert into send_SMS_Log (Tdatetime)
select @stime

while @stime<DATEADD(DAY,-1,@etime)
begin
insert into send_SMS_Log (Tdatetime)
select DATEADD(DAY,1,@stime)
set @stime=DATEADD(DAY,1,@stime)
end

 

posted @ 2015-02-13 15:20  蜜雪粮液  阅读(617)  评论(0编辑  收藏  举报