----------------------------------------------------------- New Message on MumbaiUserGroup
----------------------------------------------------------- From: Star_Venkat Message 1 in Discussion Usage of SQL_Variant and How to retrieve the type of SQL_Variant: Below is the code to retrive the type of the data stored in sql_variant variable.<o:p></o:p> The sql_variant_property is used to retrieve the base type of the sql_variant.<o:p></o:p> <o:p> </o:p> Select sql_variant_property(@variant1, 'BaseType'), sql_variant_property(@variant2, 'BaseType')<o:p></o:p> <o:p> </o:p> Sql Server is providing options to create column with type sql_variant for the columns created<o:p></o:p> in the table. <o:p> </o:p> Create Table UserFields (MyPK int NOT NULL, DataField char(10) NOT NULL,DataValue sql_variant NULL) <o:p></o:p> We can insert any type of variable in the column declared as sql_variant type. Insert UserFields Values (1, 'HireDate', convert(datetime, '6/20/00 17:32:19.567') )<o:p></o:p> Insert UserFields Values (1, 'Discount', Convert(numeric(5,4), 0.2156 ) )<o:p></o:p> <o:p></o:p> select * from UserFields Regards, Venkatesan Prabu. J ----------------------------------------------------------- To stop getting this e-mail, or change how often it arrives, go to your E-mail Settings. http://groups.msn.com/MumbaiUserGroup/_emailsettings.msnw Need help? If you've forgotten your password, please go to Passport Member Services. http://groups.msn.com/_passportredir.msnw?ppmprop=help For other questions or feedback, go to our Contact Us page. http://groups.msn.com/contact If you do not want to receive future e-mail from this MSN group, or if you received this message by mistake, please click the "Remove" link below. On the pre-addressed e-mail message that opens, simply click "Send". Your e-mail address will be deleted from this group's mailing list. mailto:[EMAIL PROTECTED]
