SQL Server/T-SQL Tutorial/Date Functions/DATEFIRST
SELECT DATEPART(weekday, CAST("20051004" AS DATETIME) + @@DATEFIRST);
6> SELECT DATEPART(weekday, CAST("20051004" AS DATETIME) + @@DATEFIRST);
7> GO
-----------
3
-----------
3
1>
To change the first day value, you can use the SET DATEFIRST command.
5> SET DATEFIRST 7
6> GO
Using SQL Server"s First Day of the Week Setting
3>
4> SELECT @@DATEFIRST "First Day of the Week"
5> GO
First Day of the Week
---------------------
7
(1 rows affected)