@@DateFirst Different when scheduled

  • Houston we have a problem......

    When a job runs it states that today(Tuesday) is day 2, when using SELECT DATEPART(DW,GETDATE()).  However open Query Analyser and run the same statement, the returning value is 3.  The correct Datepart for today (Tuesday) for the business, should be three as we have selected that the first day of the week is Sunday.

    Does anyone know why this is and how to fix this?

    Many Thanks

  • Research using SET DATEFIRST in BOL.  This way you can tell the system what date you want to be the 1st day of the week.  This is ONLY good for the scope of the procedure and does not modify the server



    Good Hunting!

    AJ Ahrens


    webmaster@kritter.net

  • @@DATEFIRST is dependant on the Language setting for your login, check the Language settings for the login that is running the job and the login you use for QA,  e.g.

    @@DATEFIRST = 1 for 'British English'

    @@DATEFIRST = 7 for 'English'

    Far away is close at hand in the images of elsewhere.
    Anon.

  • Also, in QA - if you select "use regional settings when displaying currency, number, dates, and times"

    under the "connections" tab in "tools" - "options" you should see the difference in the locale setting..







    **ASCII stupid question, get a stupid ANSI !!!**

  • Thank you, the issue was down to the default language of the domain account running the job.

    Once again thank you!!!!!!!

     

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply