L' Eomot Inversé (2/15/2013)
L' Eomot Inversé (2/14/2013)
Koen Verbeeck (2/13/2013)
This question could've been better if the question asker realized there are more than one countries in the world.
Actually, all we need to know is that only two of the four functions suggested will ever produce data in that format and of those two only one will ever produce data different from the local time. We don't need to know anything about the location. If we did, we could narrow it down to 2 countries from the data provided, but not to 1 - maybe whoever next sets a question like this could use UTC+05:45 just so that we could narrow it to 1 country.
You do need to know about the implications of the locations as the question asked was what WILL generate the desired result not what MAY do so. For myself and the majority of other users none of them WILL do so. It is only in the case of specific non default setup that any of the answers given MAY generate the given result.
If the answer to the question depends on some specific setup then that setup needs to be defined in the question.
The question says YOUR computer shows the following system date and time - well MY computer doesn't show that date and time so the question must be wrong - how can I answer it if I have to imagine a set of circumstances that don't precisely apply to my own situation?
The 'specific non default setup' of someone being in a different time zone to myself is just too much for me to contemplate.:w00t:
What worries me there is that - even with the very appropriate emoticon - the person to whom you replied may be insufficiently awake to detect your sarcasm. But I still wish I could have gotten in first with a response like yours :exclamationmark: 😀
I noticed it several hours ago but as it just supported my point didn't feel it needed a response.
The main issue with this question has nothing to do with understanding of the operation of SQL server but rather the failure of the poser or the person selecting them to properly formulate this question. These question have the intent of educating but fail miserably when they highlight other failings although the arguments resulting from it certainly succeed in that respect.
The problem with this setup that makes it non default is twofold - the client and server that the user is using are set to different timezones from each other and that the country settings of the server does not match the default for that time zone. More importantly these differences affect the result.
I would not consider it to be a non default installation if both were set to the same timezone as each other and the country settings to match at least one country in that timezone. That that timezone is different from my own generally is irrelevant. Although in this case as my timezone is GMT which is for practical purposes the same as UTC it opens up the possibility that two of the answers will in that particular situation generate the same result.
Here the answer considered to be correct will only be obtained if you run with the specific settings of client and server being offset from each other by that time difference.
This is the difference betwwen the arguments
Joey is a Budgie
All budgies are birds
Hence Joey is a bird
Which is a valid assertion
Joey is a bird
All budgies are birds
Hence Joey is a budgie
which cannot be assumed from the statements given
The ability to fully specify the problem is a fundemental requirement for effective coding and as the act of submitting a question to be QOTD implies a level of expertise it is reasonable to expect them to fully describe the environment.