November 10, 2011 at 2:25 pm
bitbucket-25253 (11/10/2011)
Since it caused you to take time to answer, in my humble opinion it was a GREAT question .. particulary since I have followed many of your forum postings and learned a great deal from them, it is I who thanks you for being an outstanding contributor here on SSC.
Yes I enjoyed it (in a slightly masochistic way)...and thanks π
November 10, 2011 at 2:39 pm
Hugo Kornelis (11/10/2011)
I only got it right because I figured that the relative order of the date and time related values would be "logical". And since the conversion to smalldatetime would chop off the seconds and the conversion to date the entire time portion, the only logical ordering of those three would be date / smalldatetim / datetime. So I knew that I was looking for an answer where the number 2 was before 3, and 3 before 5 - with the other two numbers at any possible location. My luck was that there was only one solution left after applying this filter! π
My thought process EXACTLY. Correct answer in seconds, although I probably would have learned more if I did the research others did. Still, I'm proud to have had a short burst of Hugo-think!
.
November 11, 2011 at 1:58 am
SQL Kiwi (11/10/2011)
Terrible question, and horrible answer. Thanks, I guess π
I'm afraid I don't understand how you came to that assessment. The question was fair, the answer could be determined from Books Online with a bit of time investment. I'm not sure if anyone would actually ever WANT to sort on a sql_variant column, but if we're going to judge QotD's by practical everyday use, most would not make the cut.
The only minor gripe I have is that it was possible to eliminate all incorrect answers by looking at the date/time values only, without ever having to look into (er even understand!) the relative sort order of data types.
November 11, 2011 at 3:38 am
Hugo Kornelis (11/11/2011)
I'm afraid I don't understand how you came to that assessment.
My comment was ironic / tongue-in-cheek.
November 11, 2011 at 3:57 am
SQL Kiwi (11/11/2011)
Hugo Kornelis (11/11/2011)
I'm afraid I don't understand how you came to that assessment.My comment was ironic / tongue-in-cheek.
Ah, okay. Thanks!
I'll see to getting that irony detector fixed. π
November 11, 2011 at 9:24 am
vk-kirov (11/10/2011)
Nils Gustav StrΓ₯bΓΈ (11/10/2011)
Good question, but I'm not sure that the explanation is 100% correct.I'm sure that the part of the explanation was deleted by accident:
Because values from different data type families must be explicitly cast before being referenced in comparison predicates, the effects of the something is missing here The values in the following table are examples of the rules regarding data type precedence.
I think the meaning of the explanation is that a programmer must use something like "CAST(sql_variant_value AS datatype)" or "CONVERT(datatype, sql_variant_value, style)" rather than "sql_variant_value" by itself.
Great way of explaining the point to the question. It was very vague what the purpose was, what I was "learning". Then I read your explination about the deleted text and found some meaning. :hehe: Thank You! π
November 11, 2011 at 9:54 am
tks for the question - as before, this is something I don't utilize so has forced me to research the topic more.
November 15, 2011 at 5:57 am
Thanks for the question, made me think a little this morning.
http://brittcluff.blogspot.com/
November 15, 2011 at 9:58 am
Thanks for the question.
Viewing 9 posts - 31 through 38 (of 38 total)
You must be logged in to reply to this topic. Login to reply