update tab set 工作安排=case datepart(dd,日期)%6 when 0 then '休息日' when 1 then '工作日' when 2 then '工作日' when 3 then '工作日' when 4 then '工作日' when 5 then '休息日' end from 表1
你可以选择任意一个起始日假设为'2004-01-01'且为工作日的开始, 通过如下可以生成任何时候的工作安排;update tab set 工作安排=case datediff(day,'2004-01-01',日期)%6 when 0 then '休息日' when 1 then '工作日' when 2 then '工作日' when 3 then '工作日' when 4 then '工作日' when 5 then '休息日' end
set 工作安排=case datepart(dd,日期)%6
when 0 then '休息日'
when 1 then '工作日'
when 2 then '工作日'
when 3 then '工作日'
when 4 then '工作日'
when 5 then '休息日'
end
from 表1
通过如下可以生成任何时候的工作安排;update tab
set 工作安排=case datediff(day,'2004-01-01',日期)%6
when 0 then '休息日'
when 1 then '工作日'
when 2 then '工作日'
when 3 then '工作日'
when 4 then '工作日'
when 5 then '休息日'
end