Export (0) Print
Expand All
Expand Minimize
1 out of 4 rated this helpful - Rate this topic

@@DATEFIRST (Transact-SQL)

Updated: 14 April 2006

Returns the current value, for the session, of SET DATEFIRST.

Topic link icon Transact-SQL Syntax Conventions


@@DATEFIRST

tinyint

SET DATEFIRST indicates the specified first day of each week. The U.S. English default is 7, Sunday.

Language settings affect date information. In the following example, the language is first set to italian. SELECT @@DATEFIRST returns 1. The language is then set to us_english. SELECT @@DATEFIRST returns 7.

SET LANGUAGE italian
GO
SELECT @@DATEFIRST
GO
SET LANGUAGE us_english
GO
SELECT @@DATEFIRST

The following example sets the first day of the week to 5 (Friday), and assumes the current day, Today, to be Saturday. The SELECT statement returns the DATEFIRST value and the number of the current day of the week.

SET DATEFIRST 5
SELECT @@DATEFIRST AS '1st Day', DATEPART(dw, GETDATE()) AS 'Today'

Here is the result set:

1st Day           Today
----------------  --------------
5                 2

Release History

14 April 2006

New content:
  • Added information about the effect of language settings on @@DATEFIRST.
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.