如何使用只使用the而不使用CASE语句来获取周日名称,以了解周日整数值?
例如,如果周日整数值为2,则需要将“星期一”作为周日名称。
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发布于 2015-04-17 16:04:51
你应该用DATENAME来做这个。https://msdn.microsoft.com/en-us/library/ms174395.aspx
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此外,您应该摆脱不使用日期函数快捷方式的习惯。
https://stackoverflow.com/questions/29703577
复制相似问题