1. 程式人生 > 資料庫 >SQLSERVER返回當前日期是星期幾的函式datepart

SQLSERVER返回當前日期是星期幾的函式datepart

datepart 返回數值;

例子:

select
case datepart(dw,getdate())
when 1 then '星期天 ’
when 2 then '星期一 ’
when 3 then '星期二 ’
when 4 then '星期三 ’
when 5 then '星期四 ’
when 6 then '星期五 ’
when 7 then '星期六 ’
end