Datetime 从SQL Server 2012中的工作日整数获取工作日名称

Datetime 从SQL Server 2012中的工作日整数获取工作日名称,datetime,sql-server-2012,Datetime,Sql Server 2012,如何仅使用T-SQL而不使用CASE语句来获取知道周日整数值的周日名称 例如,如果week-day整数值为2,那么我需要获取'Monday'作为week-day名称 declare @currentDate as DATETIME; set @currentDate = getdate(); SELECT DATEPART(dw, @currentDate) as WeekDayIntegerValue, '' as WeekDayName --i need the t-sql t

如何仅使用T-SQL而不使用CASE语句来获取知道周日整数值的周日名称

例如,如果week-day整数值为2,那么我需要获取'Monday'作为week-day名称

declare @currentDate as DATETIME;
set @currentDate = getdate();
SELECT DATEPART(dw, @currentDate) as WeekDayIntegerValue,
       '' as WeekDayName --i need the t-sql to use for this column

您应该为此使用DATENAME

此外,您应该改掉不使用日期函数快捷方式的习惯


当你说避免走捷径时,你的意思是用“工作日”代替“工作日”?是的,这是有道理的。
declare @currentDate as DATETIME;
set @currentDate = getdate();
SELECT DATEPART(dw, @currentDate) as WeekDayIntegerValue,
       DATENAME(weekday, @currentDate) as WeekDayName 
       --i need the t-sql to use for this column