Friday , December 6 2024

SET DATEFIRST Statement and @@DATEFIRST Function in SQL Server(TSQL)

 

We can set the first day of the week for a session with SET DATEFIRST Statement. We can query the first day of the week for a session with the @@DATEFIRST Function.

First, by opening a session, let’s query the first day of the week with the @@DATEFIRST function.

For a more meaningful result instead of 7, let’s change the query as follows.

Now let’s set the first day of the week to 1 and run the same query.

Loading

About dbtut

We are a team with over 10 years of database management and BI experience. Our Expertises: Oracle, SQL Server, PostgreSQL, MySQL, MongoDB, Elasticsearch, Kibana, Grafana.

Leave a Reply

Your email address will not be published. Required fields are marked *