SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


T-SQL


T-SQL

Author
Message
SQL Editor
SQL Editor
Right there with Babe
Right there with Babe (754 reputation)Right there with Babe (754 reputation)Right there with Babe (754 reputation)Right there with Babe (754 reputation)Right there with Babe (754 reputation)Right there with Babe (754 reputation)Right there with Babe (754 reputation)Right there with Babe (754 reputation)

Group: General Forum Members
Points: 754 Visits: 363
Good....
ziangij
ziangij
Hall of Fame
Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)

Group: General Forum Members
Points: 3138 Visits: 376
nice question, thanks :-)
shaycullen
shaycullen
SSC-Enthusiastic
SSC-Enthusiastic (143 reputation)SSC-Enthusiastic (143 reputation)SSC-Enthusiastic (143 reputation)SSC-Enthusiastic (143 reputation)SSC-Enthusiastic (143 reputation)SSC-Enthusiastic (143 reputation)SSC-Enthusiastic (143 reputation)SSC-Enthusiastic (143 reputation)

Group: General Forum Members
Points: 143 Visits: 222
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
Koen Verbeeck
Koen Verbeeck
One Orange Chip
One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)

Group: General Forum Members
Points: 27665 Visits: 13268
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


Rolleyes

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?
My blog at SQLKover.

MCSE Business Intelligence - Microsoft Data Platform MVP
Daniel Bowlin
Daniel Bowlin
SSCarpal Tunnel
SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)

Group: General Forum Members
Points: 4136 Visits: 2629
Good question. I wasn't positive of the cut off, so I had to do some research and learn something. Thanks.
shaycullen
shaycullen
SSC-Enthusiastic
SSC-Enthusiastic (143 reputation)SSC-Enthusiastic (143 reputation)SSC-Enthusiastic (143 reputation)SSC-Enthusiastic (143 reputation)SSC-Enthusiastic (143 reputation)SSC-Enthusiastic (143 reputation)SSC-Enthusiastic (143 reputation)SSC-Enthusiastic (143 reputation)

Group: General Forum Members
Points: 143 Visits: 222
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
John Mitchell-245523
SSChampion
SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)

Group: General Forum Members
Points: 14354 Visits: 15980
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
Rune Bivrin
Hall of Fame
Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)

Group: General Forum Members
Points: 3908 Visits: 1502
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
Gopi S
SSC Veteran
SSC Veteran (229 reputation)SSC Veteran (229 reputation)SSC Veteran (229 reputation)SSC Veteran (229 reputation)SSC Veteran (229 reputation)SSC Veteran (229 reputation)SSC Veteran (229 reputation)SSC Veteran (229 reputation)

Group: General Forum Members
Points: 229 Visits: 325
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
Sean Lange
One Orange Chip
One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)

Group: General Forum Members
Points: 26352 Visits: 17556
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.

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)
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search