SQL DATEPART(dw,date) need monday = 1 and sunday = 7

后端 未结 12 635
[愿得一人]
[愿得一人] 2020-12-23 16:27

I have a Query where I get the WeekDay of a date but by default:

  • Sunday = 1

  • Moday = 2

  • etc.

12条回答
  •  一个人的身影
    2020-12-23 17:20

    You would need to set DATEFIRST. Take a look at this article. I believe this should help.

    https://docs.microsoft.com/en-us/sql/t-sql/statements/set-datefirst-transact-sql

提交回复
热议问题