Welcome  |  Sign In     | 
MSDN
     
Transact-SQL Reference
@@DATEFIRST
Transact-SQL Reference
@@DATEFIRST

  Topic last updated -- July 2003

Returns the current value of the SET DATEFIRST parameter, which indicates the specified first day of each week: 1 for Monday, 3 for Wednesday, and so on through 7 for Sunday.

Syntax

@@DATEFIRST

Return Types

tinyint

Remarks

The U.S. English default is 7, Sunday.

Examples

This 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

See Also

DATEPART

Configuration Functions

SET DATEFIRST


©2007 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
 
Page view tracker