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

Variant order 1 Expand / Collapse
Author
Message
Posted Wednesday, November 30, 2011 8:39 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: Friday, August 29, 2014 10:23 AM
Points: 3,299, Visits: 1,978
Interesting question. My brain did the auto translation that v3=v2 was the same as v2=v3 so I didn't even notice that error until I hit the posts here!

I have not yet seen sql variants actually used in production but then again, we have very few 2008 instances up and running. I am curious how many out there are utilizing sql_variant and under which circumstances?


Post #1213994
Posted Wednesday, November 30, 2011 8:49 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 10:24 AM
Points: 5,977, Visits: 8,239
KWymore (11/30/2011)
I have not yet seen sql variants actually used in production but then again, we have very few 2008 instances up and running.

There is no connection between sql_variant and SQL Server 2008. This data type has been around since at least SQL Server 2000. (I think even before that, but I could not find evidence of that, and I'm not sure if I can trust my memory anymore).



Hugo Kornelis, SQL Server MVP
Visit my SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
Post #1214007
Posted Wednesday, November 30, 2011 8:53 AM


SSC-Insane

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

Group: General Forum Members
Last Login: Friday, August 29, 2014 1:51 PM
Points: 21,644, Visits: 15,317
Thanks for the question.



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


SQL RNNR

Posting Performance Based Questions - Gail Shaw
Posting Data Etiquette - Jeff Moden
Hidden RBAR - Jeff Moden
VLFs and the Tran Log - Kimberly Tripp
Post #1214012
Posted Wednesday, November 30, 2011 8:54 AM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Friday, August 29, 2014 10:20 AM
Points: 1,740, Visits: 6,366
KWymore (11/30/2011)
I am curious how many out there are utilizing sql_variant and under which circumstances?


I've used it for generic audit tables, where we store something like table name, column name, old value, new value - the old/new values are sql_variant as they could be any data type.
Of course you'd never do any comparisons between different data types in these circumstances.
Post #1214013
Posted Wednesday, November 30, 2011 8:54 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Thursday, January 31, 2013 8:53 AM
Points: 1,176, Visits: 778
Tks Tom for the question
Post #1214014
Posted Wednesday, November 30, 2011 8:59 AM


SSC-Insane

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

Group: General Forum Members
Last Login: Friday, August 29, 2014 1:51 PM
Points: 21,644, Visits: 15,317
Hugo Kornelis (11/30/2011)
Gerardo Galvan Castro (11/30/2011)
In the e-mail newsletter the QotD did not state it was for SQL Server 2008 and later, so I tested under SQL Server 2005 (the only version I have available to use), which would not allow me to run it because "you cannot assign a default value to a local variable", so i chose "None of the above" just to find out it was meant to be run under SQLS 2K8.

I'd say, with both SQL Server 2008 and SQL Server 2008R2 released and SQL Server 2012 around the corner, it is safe to assume that question are about SQL Server 2008/2008R2 unless specified otherwise.


Agreed.




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


SQL RNNR

Posting Performance Based Questions - Gail Shaw
Posting Data Etiquette - Jeff Moden
Hidden RBAR - Jeff Moden
VLFs and the Tran Log - Kimberly Tripp
Post #1214023
Posted Wednesday, November 30, 2011 9:00 AM


SSC-Insane

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

Group: General Forum Members
Last Login: Friday, August 29, 2014 1:51 PM
Points: 21,644, Visits: 15,317
Toreador (11/30/2011)
KWymore (11/30/2011)
I am curious how many out there are utilizing sql_variant and under which circumstances?


I've used it for generic audit tables, where we store something like table name, column name, old value, new value - the old/new values are sql_variant as they could be any data type.
Of course you'd never do any comparisons between different data types in these circumstances.


That is a good use - thanks for posting that. I will have to explore that use.




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


SQL RNNR

Posting Performance Based Questions - Gail Shaw
Posting Data Etiquette - Jeff Moden
Hidden RBAR - Jeff Moden
VLFs and the Tran Log - Kimberly Tripp
Post #1214024
Posted Wednesday, November 30, 2011 9:22 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: Today @ 2:57 AM
Points: 3,069, Visits: 3,251
KWymore (11/30/2011)
Interesting question. My brain did the auto translation that v3=v2 was the same as v2=v3 so I didn't even notice that error until I hit the posts here!



+1


-------------------------------
Posting Data Etiquette - Jeff Moden
Smart way to ask a question

There are naive questions, tedious questions, ill-phrased questions, questions put after inadequate self-criticism. But every question is a cry to understand (the world). There is no such thing as a dumb question. ― Carl Sagan
I would never join a club that would allow me as a member - Groucho Marx
Post #1214047
Posted Wednesday, November 30, 2011 9:28 AM


SSC-Insane

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

Group: General Forum Members
Last Login: Friday, August 29, 2014 1:51 PM
Points: 21,644, Visits: 15,317
Stuart Davies (11/30/2011)
KWymore (11/30/2011)
Interesting question. My brain did the auto translation that v3=v2 was the same as v2=v3 so I didn't even notice that error until I hit the posts here!



+1

+1




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


SQL RNNR

Posting Performance Based Questions - Gail Shaw
Posting Data Etiquette - Jeff Moden
Hidden RBAR - Jeff Moden
VLFs and the Tran Log - Kimberly Tripp
Post #1214055
Posted Wednesday, November 30, 2011 9:53 AM


SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Friday, August 22, 2014 8:50 AM
Points: 4,425, Visits: 3,417
SQLRNNR (11/30/2011)
Stuart Davies (11/30/2011)
KWymore (11/30/2011)
Interesting question. My brain did the auto translation that v3=v2 was the same as v2=v3 so I didn't even notice that error until I hit the posts here!



+1

+1

+1
Post #1214077
« Prev Topic | Next Topic »

Add to briefcase «««23456»»

Permissions Expand / Collapse