--根据日期查询星期
SELECT SYSDATETIME();
select datepart(weekday,getdate());

SET DATEFIRST 1
select '星期'+case when cast(datepart(dw,getdate()) as char(1))= 7 then '天' else cast(datepart(dw,getdate()) as char(1)) end

 

select @@datefirst;

datefirst 一般美国采用星期天作为一周的第一天(默认)。

按照中国的习惯,我们可以设置周一的为一周的开始。 set datefirst 1

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-09-30
  • 2021-11-19
  • 2021-08-26
  • 2022-12-23
  • 2021-09-13
  • 2022-12-23
猜你喜欢
  • 2021-12-28
  • 2021-11-19
  • 2021-11-18
  • 2022-01-05
  • 2021-12-14
  • 2021-09-27
  • 2022-12-23
相关资源
相似解决方案