select case when datepart(hh,getdate())<12 then '上午' else  '下午' end 

解决方案 »

  1.   

    select case when convert(char(5),getdate(),114)<'12:00' then '上午' else  '下午' end
      

  2.   

    select case when day(getdate())=day(dateadd(hh,12,getdate()) then '上午' 
           else '下午'
        end
      

  3.   

    一楼是用datepart,二楼是用convert转标准格式后截字符串,都可以。
    接分,呵呵
      

  4.   

    select case when datename(hh,getdate())<12 then '上午' else  '下午' end 
    或者
    select case when day(getdate())=day(dateadd(hh,12,getdate())) then '上午' 
           else '下午'end