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 «««1234»»

Date Conversions Expand / Collapse
Author
Message
Posted Wednesday, June 6, 2012 12:44 PM
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: Monday, November 10, 2014 12:05 PM
Points: 3,969, Visits: 3,648
Very interesting behavior. Thanks for the question.
Post #1312121
Posted Wednesday, June 6, 2012 3:32 PM
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: 2 days ago @ 11:55 AM
Points: 3,806, Visits: 1,235
Nice question, answers were hard to read, but in the end I got my point.

"El" Jerry.


"El" Jerry.

"A watt of Ottawa" - Gerardo Galvan

To better understand your help request, please follow these best practices.
Post #1312216
Posted Thursday, June 7, 2012 1:41 AM


SSCrazy Eights

SSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy Eights

Group: General Forum Members
Last Login: Yesterday @ 4:18 PM
Points: 9,928, Visits: 11,206
When you run the follow script in SSMS, which of the outputs do you expect to be returned?

Surely all answers are right, unless chooses an unexpected answer?

I was aware of the point the question was looking to make, but couldn't be bothered fighting through the text to prove it so picked one at random. I got it 'wrong'.




Paul White
SQL Server MVP
SQLblog.com
@SQL_Kiwi
Post #1312333
Posted Thursday, June 7, 2012 3:22 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: 2 days ago @ 9:11 PM
Points: 1,302, Visits: 1,146
The posert should have limited to only two options.

even though we knew the answer very difficult to spot on from the options.

Seems like a test for the eyes rather than SQLserver.
Post #1312365
Posted Thursday, June 7, 2012 5:32 AM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Yesterday @ 7:23 PM
Points: 20,860, Visits: 32,883
I get it, I should have used the DATE data type instead of DATETIME2 for the question so I could have left off the time portion on the answers. How about everyone just quit complaining about that, this wasn't a test for the eyes.

I found out about a behaviour regarding datetime conversions that existed starting in SQL Server 2008 with the addition of several new date/time data types that I wasn't aware of and that wasn't even described why it was happening and I dug into it more. I thought it would be a great QotD and submitted it.

Also, for the code as presented, there is only one correct answer.

The reason I didn't give only 2 possibilities is that I didn't want it to be a 50/50 guess. I was trying to make it a bit more challenging than that.



Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Post #1312397
Posted Thursday, June 7, 2012 9:32 AM


SSCoach

SSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoach

Group: General Forum Members
Last Login: Yesterday @ 3:20 PM
Points: 18,064, Visits: 16,099
Koen Verbeeck (6/5/2012)
Very interesting question, but those answers were hard to read


+10




Jason AKA CirqueDeSQLeil
I have given a name to my pain...
MCM SQL Server, MVP


SQL RNNR

Posting Performance Based Questions - Gail Shaw
Post #1312599
Posted Friday, June 8, 2012 8:20 AM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Friday, December 5, 2014 2:22 PM
Points: 1,586, Visits: 1,860
AndyK-565224 (6/6/2012)
I would like to hear a SQL philosopher/historian explain how this situation came about. It seems such a violation of language orthogonality - lying in wait to create bad data.


I agree - it seems like a bad idea.

Found this chart on BOL "Using Date and Time Data"
[url=http://msdn.microsoft.com/en-us/library/ms180878(v=sql.100).aspx][/url]

There are some subtle format differences that seem very arbitrary to me.
Post #1313159
Posted Friday, June 8, 2012 9:44 AM


SSCrazy Eights

SSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy Eights

Group: General Forum Members
Last Login: Yesterday @ 4:18 PM
Points: 9,928, Visits: 11,206
Carla Wilson-484785 (6/8/2012)
There are some subtle format differences that seem very arbitrary to me.

It's often a backward-compatibility thing.




Paul White
SQL Server MVP
SQLblog.com
@SQL_Kiwi
Post #1313244
Posted Friday, June 8, 2012 2:57 PM
Right there with Babe

Right there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with Babe

Group: General Forum Members
Last Login: Thursday, December 11, 2014 12:53 PM
Points: 790, Visits: 1,192
Why wouldn't all selects error out as in the example in MS189491 when the set dateformat's used both end with year but all the dates start with the year?
Post #1313402
Posted Wednesday, June 13, 2012 8:50 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Wednesday, December 3, 2014 8:17 AM
Points: 2,917, Visits: 2,537
Good way to return from vacation. Good question, but reading the answers was a new experience in eyeball manipulation


Steve Jimmo
Sr DBA
“If we ever forget that we are One Nation Under God, then we will be a Nation gone under." - Ronald Reagan
Post #1315193
« Prev Topic | Next Topic »

Add to briefcase «««1234»»

Permissions Expand / Collapse