Datefirst

  • This was removed by the editor as SPAM

  • Almost a nice question, but actually not correct. The assumption that the server default language is us_english isn't adequate; you have to assume that the default language for the login used to connect SSMS to the server is us_english, because the new query will use a new session, which will use the login's default language, not the language that has been set for the first query's session, and the login's default can be different from the server default. The set statement commented "just to make sure" in the first query merely makes sure that the session containing that query will use us_english, not that the other session will.

    In SQL 2012 there's another complication - if it's a contained database, the second call will use the databases default language if the login hasn't set a different default language, and the databases default language may be different from the server default. Was that what the instruction to connect to the same database for the second query as for the first was about? If it's not a contained database, the database is irrelevant; and even if it is, the assumption you need is that the login's default language is us-english. so the database would be irrelevant if the right assumption had been stated instead of an inadequate one.

    Tom

  • rodjkidd (9/13/2013)


    Silly me, didn't have coffee yet and missed the second part!

    Yes per session!! So new session will be 7

    Rodders...

    Maybe. If your login's default language is British it will be 1, and I guess it may be that as your server is in Britain. And so on. The question says assume the server default is us-english, but it should say assume the login default is us-english.

    Tom

  • Koen Verbeeck (9/13/2013)


    Very nice question to close off the week.

    And kudos for mentioning the default language, so there's less whining in the discussion πŸ˜€

    Yah I thought that was a nice touch too. πŸ™‚



    --Mark Tassin
    MCITP - SQL Server DBA
    Proud member of the Anti-RBAR alliance.
    For help with Performance click this link[/url]
    For tips on how to post your problems[/url]

  • Koen Verbeeck (9/13/2013)


    Very nice question to close off the week.

    And kudos for mentioning the default language, so there's less whining in the discussion πŸ˜€

    Well, any reduction in wining is a good thing. But the default mentioned was the wrong one. The server default language is irrelevant if the user default language is different.

    Tom

  • Great question! Thank You!

  • Nice simple question to begin the week with (in my region),

    good to know some new info; the default value of @@DATEFIRST for language 'us_english' is 7;

    as I tried for many other languages I got the same default result as [1].

    Thanks & Best Regards,
    Hany Helmy
    SQL Server Database Consultant

  • Nice and steady wins the race - easy QotD for the week.

    Hope this helps...

    Ford Fairlane
    Rock and Roll Detective

  • Koen Verbeeck (9/13/2013)


    Very nice question to close off the week.

    And kudos for mentioning the default language, so there's less whining in the discussion πŸ˜€

    +1 for the author. Even ensured that people having different language settings get the scenario correctly. πŸ™‚

  • sqlnaive (9/18/2013)


    Koen Verbeeck (9/13/2013)


    Very nice question to close off the week.

    And kudos for mentioning the default language, so there's less whining in the discussion πŸ˜€

    +1 for the author. Even ensured that people having different language settings get the scenario correctly. πŸ™‚

    Actually no, it didn't, the author got that wrong (specified the wrong default - should have been the login's language defeult, not the server's). If you'd read earlier comments you would have understood that. Not that it matters, in terms of qotD, because it was obvious what the author meant to do and that should be enough, s kudos to teh author for trying to tie it down completely, but technically it isn't possible to detemine the result from the stated conditions.

    Tom

  • L' Eomot InversΓ© (9/18/2013)


    sqlnaive (9/18/2013)


    Koen Verbeeck (9/13/2013)


    Very nice question to close off the week.

    And kudos for mentioning the default language, so there's less whining in the discussion πŸ˜€

    +1 for the author. Even ensured that people having different language settings get the scenario correctly. πŸ™‚

    Actually no, it didn't, the author got that wrong (specified the wrong default - should have been the login's language defeult, not the server's). If you'd read earlier comments you would have understood that. Not that it matters, in terms of qotD, because it was obvious what the author meant to do and that should be enough, s kudos to teh author for trying to tie it down completely, but technically it isn't possible to detemine the result from the stated conditions.

    Totally agreed with you L' Eomot. I got your point. However as the author has mentioned as follows:

    set language 'us_english' --just to make sure

    it is going to set the default language for that session as 'us_english' no matter what the other settings are. I myself has 'british' as default in my environment. But got the answer right. Though there can be some doubt at point where the command is run in new session, but again author has mentioned that "assume the default server language is us_english" so you have to ensure the same before answering. I didn't understand where the issue is.

  • sqlnaive (9/18/2013)


    it is going to set the default language for that session as 'us_english' no matter what the other settings are. I myself has 'british' as default in my environment. But got the answer right. Though there can be some doubt at point where the command is run in new session, but again author has mentioned that "assume the default server language is us_english" so you have to ensure the same before answering. I didn't understand where the issue is.

    The issue us that if the server default is US english and the login default is something else, it's the login default that will be used in the new session; so specifying what the server default is doesn't help, unless the login default is the same. Usually, it will be (because when you cretae a login, the default for its default language is the server default); but not always - you can specify a different default language for the login, and what's used in the new session is determined by the login default, not by the server default.

    And of course the session default isn the current session makes not one bit of difference to the session language in the new session created by telling SSMS to open a new query.

    Tom

  • L' Eomot InversΓ© (9/18/2013)


    sqlnaive (9/18/2013)


    it is going to set the default language for that session as 'us_english' no matter what the other settings are. I myself has 'british' as default in my environment. But got the answer right. Though there can be some doubt at point where the command is run in new session, but again author has mentioned that "assume the default server language is us_english" so you have to ensure the same before answering. I didn't understand where the issue is.

    you can specify a different default language for the login, and what's used in the new session is determined by the login default, not by the server default.

    Gotcha, in rare case, people might fall for it where user lang setting is different than that of serve level (which in this case should be us_english). However i got the idea of the author and so applied the statement "set language 'us_english' --just to make sure" in new session and got it correct. πŸ™‚

  • Koen Verbeeck (9/13/2013)


    Very nice question to close off the week.

    And kudos for mentioning the default language, so there's less whining in the discussion πŸ˜€

    +1

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

Viewing 14 posts - 16 through 28 (of 28 total)

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