select case when convert(char(5),getdate(),114)<'12:00' then '上午' else '下午' end
select case when day(getdate())=day(dateadd(hh,12,getdate()) then '上午' else '下午' end
一楼是用datepart,二楼是用convert转标准格式后截字符串,都可以。 接分,呵呵
select case when datename(hh,getdate())<12 then '上午' else '下午' end 或者 select case when day(getdate())=day(dateadd(hh,12,getdate())) then '上午' else '下午'end
else '下午'
end
接分,呵呵
或者
select case when day(getdate())=day(dateadd(hh,12,getdate())) then '上午'
else '下午'end