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):
SET LANGUAGE us_english;
SET LANGUAGE German;
To change the DATEFIRST setting for a session without changing the language setting, use the SET DATEFIRST command.
For example, to set the first day of the week to 5 (Friday), use the following command:
SET DATEFIRST 5;
Queries to get for example the first or the last day of the week depend on your language and DATEFIRST settings.
For more details read related post:
How to Get First and Last Day of a Week in SQL Server