April 13, 2011 at 8:10 am
Nice question. It seemed clear to me also that you needed to account for different language or format settings.
April 13, 2011 at 8:12 am
Oh, I agree, the question was perfectly clear--my problem was that I worked out which two wouldn't work, and then went ahead and ticked them without thinking about what I was doing rather than ticking the OTHER two! 😀
April 13, 2011 at 8:35 am
bitbucket-25253 (4/13/2011)
Duncan Pryde (4/13/2011)
bitbucket-25253 (4/13/2011)
A good question. As of 9:20 AM only 28 percent correct answers.Your QOD has achieved one of the major objectives ... teaching
Thanks - although I'd have hoped the percentage of correct answers would have been considerably higher given the answers were in the links I'd posted as part of the explanation of last week's question. But then it looks like some people are getting it wrong because they misread the question, not because they didn't know the answer.
Maybe I will need to revisit this topic in another QotD :blink:
Indeed, definitely post another QOD concerning dates and time. if memory serves me correctly, last weeks percent correct was about 28 so it is an area that needs more teaching.
OK, you've twisted my arm. I'll get onto it after my current workload has subsided a bit.
On the subject of things it would be good to have QotD about, I've started another topic here if anyone would like to contribute:
http://www.sqlservercentral.com/Forums/Topic1092873-4-1.aspx
April 13, 2011 at 8:43 am
Nice question. I'm learning more about date types than I expected!
April 13, 2011 at 8:55 am
Not sure what I'm missing but the only one that failed for me was the datetime. Tried British, German, Italian, US_English. Tried dateformat as ymd, dmy, mdy and the only one that failed was datetime when set to dmy. All this on SQL 2008 SP2.
Al Kessler
It's too bad that
Common Sense Isn't
April 13, 2011 at 9:05 am
al_kessler (4/13/2011)
Not sure what I'm missing but the only one that failed for me was the datetime. Tried British, German, Italian, US_English. Tried dateformat as ymd, dmy, mdy and the only one that failed was datetime when set to dmy. All this on SQL 2008 SP2.
Smalldatetime should fail under exactly the same circumstances as datetime since as far as I can tell their behaviour is identical. It certainly fails for me, anyway:
SET DATEFORMAT ydm
GO
SELECT CAST('2011-04-28' AS SMALLDATETIME)
Duncan
April 13, 2011 at 9:12 am
Even tho the question stated..."regardless of any date format..." this is another question with a questionable question, since I found that all 4 answers do produce an answer without any errors. It's almost getting to the point where the QotD is questionable(?)
April 13, 2011 at 9:14 am
nelsonj-902869 (4/13/2011)
Even tho the question stated..."regardless of any date format..." this is another question with a questionable question, since I found that all 4 answers do produce an answer without any errors. It's almost getting to the point where the QotD is questionable(?)
It's not questionable at all. The question was asking which of the four things work no matter what your date format is--try changing your date format to something like dmy and you should find two of them no longer work, so obviously they're not the right answers!
April 13, 2011 at 9:41 am
Another great question, thanks!
April 13, 2011 at 9:46 am
paul.knibbs (4/13/2011)
Oh, I agree, the question was perfectly clear--... 😀
I agree - I felt the question was very precise and clear in the meaning and intent.
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
April 13, 2011 at 9:53 am
Good question, but tough to get it right 🙂
M&M
April 13, 2011 at 9:55 am
Excellent question. Keep them coming Duncan.
April 13, 2011 at 10:00 am
A very good question. It is unfortunate that some are not getting the message that it is trying to convey, that not all date formats are portable across all language settings. If you ever have to port your application to a different country or language, this can cause a lot of rework.
April 13, 2011 at 10:03 am
CirquedeSQLeil (4/13/2011)
paul.knibbs (4/13/2011)
Oh, I agree, the question was perfectly clear--... 😀I agree - I felt the question was very precise and clear in the meaning and intent.
I can only assume that a lot of people have no idea that date format or language settings exist or what they might do.
April 13, 2011 at 10:08 am
Duncan, nice follow-up to your last question. I'm gratified? relieved? to see so many wrong answers, as I thought everyone else but me knew what Tibor Karaszi pointed out in his blog: SQL Server DATETIME and SMALLDATETIME types are not ANSI-compliant.
As a follow-up to this issue, I was quite surprised to learn that (apparently), unless you have purchased and installed a local version of SQL Server, you cannot change the language settings at the server level, only for individual logins or query sessions. (You apparently can issue the command without error, but it makes no difference.) It may be possible to make a registry change to force the language change; see http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=62891.
I cannot find official confirmation of this behavior at Microsoft, but here's a relevant article excerpt from http://www.sqlservercurry.com/2010/11/change-default-language-for-sql-server.html
If you have not installed the localized version of SQL Server, the default language is US English. If you need to change the default language on this machine, then you will have to change the default language for individual logins, as doing it on a server level won't work.
Thanks again for great questions,
Rich
Viewing 15 posts - 31 through 45 (of 58 total)
You must be logged in to reply to this topic. Login to reply