declare @dt datetime
set @dt='2016-01-01'
while (@dt<='2016-12-31')
begin
print convert(varchar(10),@dt,120)
set @dt=dateadd(DAY,1,@dt)
end
SQL SERVER中使用日期遍历
最新推荐文章于 2024-09-14 16:49:53 发布
declare @dt datetime
set @dt='2016-01-01'
while (@dt<='2016-12-31')
begin
print convert(varchar(10),@dt,120)
set @dt=dateadd(DAY,1,@dt)
end
>