The @@DATEFIRST in SQL Server is one of the Date and Time Function, which will return the first day of the week. This value is between 1 and 7. If your default language is US English, then by default, 7 is returned.
The basic syntax of SQL Server @@DATEFIRST is as shown below:
@@DATEFIRST in SQL Example
-- It will Return the Default first Day SELECT @@DATEFIRST AS 'First day of the Week' -- Set the DateFirst Value to 2 (Tuesday) SET DATEFIRST 2; -- Now let me select the first Day Value SELECT @@DATEFIRST AS 'First day of the Week' SELECT GETDATE() AS 'Today', DATEPART(dw, GETDATE()) AS 'Today Number'