Set 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):

SET LANGUAGE us_english;
SELECT @@DATEFIRST;

SET LANGUAGE German;
SELECT @@DATEFIRST;

language_setting_datefirst

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

If the post helped you, please share it:
Pin It

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">