Set First Day of the Week in SQL Server
Hello to everyone,
In this article, I will give you information about how to assign the first day of the week information in SQL Server.
You may want to change the first day of the week in SQL Server.
The DATEFIRST statement sets the first day of the week for the session to a number from 1 through 7.
In SQL Server the values for the days of the week are the following:
1 – Monday
2 – Tuesday
3 – Wednesday
4 – Thursday
5 – Friday
6 – Saturday
7 – Sunday
For example, for us_english language setting your session’s DATEFIRST setting has a default value 7 (it means that Sunday is the first day of the week), and for German it is 1 (Monday is the first day of the week)
You can also do this using the code below.
SET LANGUAGE us_english;
SELECT @@DATEFIRST;
SET LANGUAGE German;
SELECT @@DATEFIRST;
When you run the code you will get the following result.
Good luck to everyone in business and life.