T-SQL

  • shaycullen

    Right there with Babe

    Points: 721

    Yeah, but the question did ask for the "output" - SQL Server will append the 00:00:00.000 onto the end, so technically none of the answers are correct.

  • John Mitchell-245523

    SSC Guru

    Points: 148777

    da-zero (12/15/2010)


    When you specify 2002-02-02 in SQL Server, 2002-02-02 00:00:00.000 is automatically assumed, so the answers are still correct.

    The precise result set is as follows:

    (No column name) (No column name) (No column name) (No column name)

    2002-02-02 00:00:00.000 2049-02-02 00:00:00.000 1950-02-02 00:00:00.000 2000-02-02 00:00:00.000

    Therefore the answers aren't quite correct. OK, the point of the question was to demonstrate century cutoffs, and not time portions. Even so, I think both the question and the answer do not show the rigour that should be expected from us as IT professionals.

    John

  • Rune Bivrin

    SSCertifiable

    Points: 7885

    shaycullen (12/15/2010)


    Yeah, but the question did ask for the "output" - SQL Server will append the 00:00:00.000 onto the end, so technically none of the answers are correct.

    SQL Server does nothing in particular (or at least not the server). It's a datetime value, and how it will look on the screen is determined by the client - in this case SQL Server Management Studio.

    Nit picking.


    Just because you're right doesn't mean everybody else is wrong.

  • Gopi S

    Ten Centuries

    Points: 1091

    I apologize to all those who assumed all answers were wrong as time portion was missing.

    As mentioned earlier, the objective of the question was to demonstrate century cutoffs and not any game puzzle :laugh: Anyhow i will note this point and make sure i publish accurate result without any assumption in future.

    Thanks

  • Sean Lange

    SSC Guru

    Points: 286536

    Good question. Don't worry about the people who are complaining about the question. There are some people who will complain no matter how clear the question is. Given the history of really tedious nit picking trick questions many people are trained to look for the most little inconsistency. My guess is that many of the people complaining would have gotten it wrong even if you had included all the details they are complaining about. 😉

    Thanks for the time creating the question for us and the topic was learned by all of us.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

  • jeff.mason

    SSCrazy Eights

    Points: 9555

    Boy does that question bring back memories. How many here have the scars of activity in 1998 and 1999 for Y2K? I bet any IT professional who had any interaction with SQL in those years got this one right. I can remember testing application after application to verify how that application would function given various year settings.

  • SanDroid

    SSChampion

    Points: 10068

    Gopinath Srirangan (12/15/2010)


    I apologize to all those who assumed all answers were wrong as time portion was missing.

    As mentioned earlier, the objective of the question was to demonstrate century cutoffs and not any game puzzle :laugh: Anyhow i will note this point and make sure i publish accurate result without any assumption in future.

    Thanks

    I liked the question and considered it well written.

    Sure the extra zeros were missing, but since there was no "NONE of the above" selection why would this confuse you? I actually apreciated them missing so as not to clutter the screen.

    I wonder how many of those that complained about this have subitted a QOTD themselves? 😛

    I have authored QOTD's for this site and I liked this one. 😎

  • SanDroid

    SSChampion

    Points: 10068

    jeff.mason (12/15/2010)


    Boy does that question bring back memories. How many here have the scars of activity in 1998 and 1999 for Y2K? I bet any IT professional who had any interaction with SQL in those years got this one right. I can remember testing application after application to verify how that application would function given various year settings.

    I can raise my hand. I actually had to start in 1995 due to all the ETL from legacy systems because of Y2K. A solution to this date conversion issue was the first M$ SQL development task I was given.

  • SQLRNNR

    SSC Guru

    Points: 281252

    Thanks for the question.

    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

  • nigelg99

    Say Hey Kid

    Points: 677

    John Mitchell-245523 (12/15/2010)


    I got this right, but I think the question should have been qualified with something like "on an instance installed with the default settings". Otherwise the answer should be "it depends on the value of the two digit year cutoff setting in sp_configure".

    John

    I think we should be able to assume that in the absence of wording to the contrary, the default environment for the question is to use the default settings. 😀

    I think most people that went through the 1999-2000 "millennium bug" period now use 4 digit years! I know I do.

  • John Mitchell-245523

    SSC Guru

    Points: 148777

    Gopinath

    Thanks for the question, which demonstrated a useful point. Please accept my criticisms in the spirt of constructive feedback which, of course, you are free to ignore if you choose! My point was that, although most people (including me) would assume default settings, it's safer not to (have to) make assumptions at all. I also take Rune's point that the answer does depend on the client, so I'll concede that one!

    John

  • SanjayAttray

    SSChampion

    Points: 13157

    Interesting question. this info is new to me.

    SQL DBA.

  • Michael Poppers

    SSCrazy

    Points: 2135

    Sean Lange (12/15/2010)


    Good question. Don't worry about the people who are complaining about the question. There are some people who will complain no matter how clear the question is. Given the history of really tedious nit picking trick questions many people are trained to look for the most little inconsistency. My guess is that many of the people complaining would have gotten it wrong even if you had included all the details they are complaining about. 😉

    Thanks for the time creating the question for us and the topic was learned by all of us.

    Agreed x 2 :-).

  • OCTom

    SSChampion

    Points: 11755

    The Y2K rush was exciting, boring, tedious, scary...

    This question does make one wonder why 2-digit years are still in use. However, since SQL Server dates only go out to 12-31-9999, we should get ready for y10k soon. 😉

    Thanks for bringing back the memories.

  • UMG Developer

    SSChampion

    Points: 13482

    Thanks for the question!

Viewing 15 posts - 16 through 30 (of 42 total)

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