May 23, 2003 at 5:45 am
datepart (dw,getdate()) returns daynumber of today, but default with sunday beiing day 1. I want monday beiing day1, ok by using set datefirst, but this is only for the current session. How to set the default to monday being 1? I tried to update syslanguages system table (all languages have now datefirst=1), but still, starting a new connetion, default setting for @@datefirst is 7 (=sunday) instead of 1 (= monday).
Any idea?
May 23, 2003 at 6:30 am
Check out BOL for DATEPART and SET DATEFIRST.
Use:
SET DATEFIRST 1
SELECT DATEPART(dw, GETDATE())
May 23, 2003 at 9:36 am
OK, as I said, datefirst is an option. But ONLY FOR CURRENT SESSION !!! I want default behaviour to be monday as day 1, I don't want to use datefirst on begin of every new session.
May 23, 2003 at 9:53 am
OK, in BOL, the article says:
quote:
RemarksUse the @@DATEFIRST function to check the current setting of SET DATEFIRST.
The setting of SET DATEFIRST is set at execute or run time and not at parse time.
I could find no evidence that @@DATEFIRST can be set on a server or database level.
June 14, 2003 at 11:58 am
JPipes is correct, unfortunately with the current versions of SQL Server, many of the date settings can only be set for the current connection, and not as a default for the entire server.
June 24, 2003 at 1:02 am
So the 'datefirst' column in the syslanguages (master) is not taken into account. Is it used for something else, or is it just there ?
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply