• From the Books Online documentation for the DATEPART function:

    "When datepart is week (wk, ww) or weekday (dw), the return value depends on the value that is set by using SET DATEFIRST."

    Many SET options are set implicitly by the tool used to connect and/or based on (server-)login and (database-)user settings.

    You can always override them by explicitly using SET DATEFIRST.


    Hugo Kornelis, SQL Server/Data Platform MVP (2006-2016)
    Visit my SQL Server blog: https://sqlserverfast.com/blog/
    SQL Server Execution Plan Reference: https://sqlserverfast.com/epr/