日期:2014-05-18 浏览次数:20635 次
declare @t table(id int,t datetime)
insert into @t select 1,'2012-05-07 13:02:01'
union all select 2,'2012-05-08 1:02:01'
union all select 3,'2012-05-08 12:02:01'
select id
,上班日期=convert(varchar(10),dateadd(mi,-240,t),120)
,上班類型=case when convert(varchar(10),t,108) between '07:30:00' and '19:30:00'
then '白班'
else '夜班'
end
from @t