Logo 
Search:

SQL Server Articles

Submit Article
Home » Articles » SQL Server » Configuration FunctionsRSS Feeds

@@DATEFIRST - DATEFIRST Function

Posted By: Sarita Patel     Category: SQL Server     Views: 3040

This article explains about @@DATEFIRST function in sql server with examples.

@@DATEFIRST function returns the SET DATEFIRST parameter. It specifies first day of each week i.e. 1 for monday, 2 for tuesday ... 7for sunday.  


Syntax of @@DATEFIRST Function :

@@DATEFIRST

Return type of @@DATEFIRST function is tinyint.


Examples of @@DATEFIRST Function :

Example 1 : Use of @@DATEFIRST function in select clause

SELECT @@DATEFIRST

Output
7

Above example returns 7 as current day of the week.



Example 2 : Use of @@DATEFIRST function in select clause 

SET DATEFIRST 1
SELECT @@DATEFIRST

Output
1

Above example sets the first day of the week to 1 i.e monday and assumes the current day is tuesday.
  
Share: 


Didn't find what you were looking for? Find more on @@DATEFIRST - DATEFIRST Function Or get search suggestion and latest updates.

Sarita Patel
Sarita Patel author of @@DATEFIRST - DATEFIRST Function is from United States.
 
View All Articles

Related Articles and Code:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!