Select @@DateFirst
returns the current value, for a session, of SET DATE FIRST, i.e it returns first day of week, TinyInt Value from 1 through 7 representing Monday to Sunday as shown Below.
1 for Monday 2 for Tuesday 3 for Wednesday 4 for Thursday 5 for Friday 6 for Saturday 7 for Sunday
For Example, If the first day of week is Sunday (US) , Then @@DateFirst would return 7.
If the first day of week is Monday (Europe), Then @@DateFirst Would return 1.
SET DateFirst = 3
The above statement would set Wednesday as first day of the week for the current Session.
‘July 1st 2009 is a wednesday
SET DateFirst = 1 -- or SET LANGUAGE Italian; Select DATEPART(dw, '20090701')
would return 3 (since Wednesday is 3rd day from Monday)
SET DateFirst = 7 -- or SET LANGUAGE us_english; Select DATEPART(dw, '20090701')
would return 4 (since Wednesday is 4th day from Sunday)
DATEPART return the weekday according @@DateFirst.