今天星期幾?
declare @today datetime
set @today = (select convert(char(10),getdate(),120))
select
CASE
WHEN datepart(weekday,@today) = 1 THEN '星期日'
WHEN datepart(weekday,@today) = 2 THEN '星期一'
WHEN datepart(weekday,@today) = 3 THEN '星期二'
WHEN datepart(weekday,@today) = 4 THEN '星期三'
WHEN datepart(weekday,@today) = 5 THEN '星期四'
WHEN datepart(weekday,@today) = 6 THEN '星期五'
WHEN datepart(weekday,@today) = 7 THEN '星期六'
END AS '_day'
----------------------------------------------------------------------------------------------
key 宣告
----------------------------------------------------------------------------------------------
select
case
when (max(click_id) is null) then 0
else (max(click_id))+1
end as '_id'
from
{ TABLE }