Giu Do Giu Do - 6 months ago 24
SQL Question

Set datefirst permanently

I'd like to change permanently the value of DATEFIRST (which is used for functions like DATEPART)

If I do this :

SET DATEFIRST 1
the value stay during the execution but it return to the default value - 7 here - after the execution

I already had the problem, I know that it's related to the country of the login but I forgot which table & which property I had to change.

Answer

I must say this took some research on my part. Take a look at the following query. You will notice the datefirst field. I would imagine there are all kinds of permission implications that go along with changing language settings at this level.

SELECT
    *
FROM
    sys.syslanguages

I don't have a server I can test this on at the moment but I would imagine through a set statement you could set the datefirst column to whatever you wanted it to be.

TEST TEST TEST as this will have huge implications across more than problem you are trying to solve.

Interesting Resource # 1

Interesting Resource # 2

Interesting Resource # 3