时间:2021-07-01 10:21:17 帮助过:2人阅读
----添加一年的工作日 DECLARE @num int DECLARE @count int set @num = 1 set @count = 1 WHILE @num <=365 --时间跨度有闰年的就是366天 begin INSERT into WeekDays VALUES ( convert(nvarchar(10),dateadd(dd,@num, ‘2017-07-05‘),23),1)-- 2017-07-05 星期三 if @count=2 begin set @num = @num+3 set @count = @count+3 end else begin set @num = @num+1 set @count = @count+1 end IF @count = 8 set @count = 1 end
SQLserver 向表中添加工作日,不排除节假日,只排出星期六星期日
标签: