|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 2:57 PM
Points: 7,079,
Visits: 7,121
|
|
Evil Kraig F (12/6/2011)
Rob Schripsema (12/5/2011) Great question. Not what I would have expected....but then, many aspects of SQLVariants are not what I would expect.
Agreed, it's like opening Pandora's Box. I'm not even sure what led Tom to finding this nugget, nevermind how I'd go about finding the full answer if he hadn't spoon-fed me what was going on in a reasonable amount of time. Variant can burn from everything I've been seeing on the complexity of its rulesets. What got me thinking of doing questions on variant order was a comment by someone (I think it was by Hugo in response to an earlier question, but not at all sure) that he had thought of doing a question on variant order but decided the ordering rules were too complex. I had come across variant ordering being misused for a purpose other than indexing some years back, and knew that people using SQL to create EAV systems sometimes got caught up in it. I knew that it was quite well documented in BoL, and the only things I couldn't remember about it was how to discover the locale version (the locale id was OK, but not the version) associated with a collation (couldn't remember that because I had never known it - and still don't, I haven't found it documented anywhere, haven't even looked for it much) and what happened with the newest types (date and datetime2). So I thought that maybe some questions would be amusing SQL trivia, because the rules are not really at all bizarre or complex.
As for using this stuff - well, you can probably guess from my use of the word "misuse" above that I believe that the order on SQL_VARIANT should be used only to support the construction of indexes, especially those associated with primary key and unique constraints. If people want to mess about with EAV models and worry about the order of SQL_VARIANT (beyond knowing that variant columns can be used in indexes and keys) they are, in my view, misguided (on both counts). But the rules are still fun SQL trivia.
Tom Que conclure à la fin de tous mes longs propos? C'est que les préjugés sont la raison des sots. (Voltaire, 1756)
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 11:51 AM
Points: 5,232,
Visits: 7,023
|
|
L' Eomot Inversé (12/7/2011) What got me thinking of doing questions on variant order was a comment by someone (I think it was by Hugo in response to an earlier question, but not at all sure) that he had thought of doing a question on variant order but decided the ordering rules were too complex. Nope, not me. I am innocent!
Hugo Kornelis, SQL Server MVP Visit my SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
|
|
|
|
|
SSC Eights!
      
Group: General Forum Members
Last Login: Saturday, March 16, 2013 9:53 AM
Points: 847,
Visits: 768
|
|
Thank you for the question
Iulian
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 2:57 PM
Points: 7,079,
Visits: 7,121
|
|
Hugo Kornelis (12/7/2011)
L' Eomot Inversé (12/7/2011) What got me thinking of doing questions on variant order was a comment by someone (I think it was by Hugo in response to an earlier question, but not at all sure) that he had thought of doing a question on variant order but decided the ordering rules were too complex.Nope, not me. I am innocent!  Quite right. It wasn't you, it was Paul, in the discussion on his Collation and SQL_VARIANT question (QOTD for 1st November), see this post and my response to it.
Tom Que conclure à la fin de tous mes longs propos? C'est que les préjugés sont la raison des sots. (Voltaire, 1756)
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Friday, January 18, 2013 9:32 AM
Points: 188,
Visits: 54
|
|
| Erudite indeed, but I don't think this is ever going to matter to me.
|
|
|
|
|
Right there with Babe
      
Group: General Forum Members
Last Login: Thursday, May 09, 2013 8:50 AM
Points: 746,
Visits: 435
|
|
440692 I am just a number (12/5/2011) Thank you A very interesting question. Alas, I could see no other way to work out the answer, than to run the code.
+1
-- Dineshbabu Desire to learn new things..
|
|
|
|
|
Right there with Babe
      
Group: General Forum Members
Last Login: Thursday, May 09, 2013 8:50 AM
Points: 746,
Visits: 435
|
|
I don't whether i will use it in the mere future. Eventhough if i use i have to go through the explaination once again on that time.
-- Dineshbabu Desire to learn new things..
|
|
|
|