Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««12345»»»

T-SQL Expand / Collapse
Author
Message
Posted Wednesday, December 15, 2010 3:47 AM
Say Hey Kid

Say Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey Kid

Group: General Forum Members
Last Login: Tuesday, September 23, 2014 6:09 AM
Points: 697, Visits: 356
Good....
Post #1035003
Posted Wednesday, December 15, 2010 4:13 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Sunday, November 2, 2014 11:03 PM
Points: 2,132, Visits: 371
nice question, thanks
Post #1035010
Posted Wednesday, December 15, 2010 4:36 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Friday, November 21, 2014 10:21 AM
Points: 122, Visits: 179
None of these are correct - as you are casting as "datetime" the results will be as follows;

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
Post #1035016
Posted Wednesday, December 15, 2010 4:58 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: 2 days ago @ 12:52 PM
Points: 13,636, Visits: 11,509
shaycullen (12/15/2010)
None of these are correct - as you are casting as "datetime" the results will be as follows;

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




Yes, the time portions were very relevant for this question.

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.




How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?

Member of LinkedIn. My blog at LessThanDot.

MCSA SQL Server 2012 - MCSE Business Intelligence
Post #1035020
Posted Wednesday, December 15, 2010 6:49 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Friday, December 12, 2014 8:24 AM
Points: 2,818, Visits: 2,567
Good question. I wasn't positive of the cut off, so I had to do some research and learn something. Thanks.
Post #1035086
Posted Wednesday, December 15, 2010 6:56 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Friday, November 21, 2014 10:21 AM
Points: 122, Visits: 179
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.

Post #1035097
Posted Wednesday, December 15, 2010 7:03 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 4:28 AM
Points: 5,488, Visits: 10,339
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
Post #1035105
Posted Wednesday, December 15, 2010 7:08 AM


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Yesterday @ 5:08 AM
Points: 3,116, Visits: 996
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.
Post #1035115
Posted Wednesday, December 15, 2010 7:26 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Sunday, November 30, 2014 9:53 PM
Points: 157, Visits: 294
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 Anyhow i will note this point and make sure i publish accurate result without any assumption in future.

Thanks
Post #1035128
Posted Wednesday, December 15, 2010 7:32 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Yesterday @ 2:05 PM
Points: 13,327, Visits: 12,820
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 Moden's splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
Post #1035131
« Prev Topic | Next Topic »

Add to briefcase ««12345»»»

Permissions Expand / Collapse