Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
phrankbooth
Posting Yak Master
162 Posts |
Posted - 2007-01-31 : 16:45:29
|
| Why does this not work?declare @ret varchar(50)DECLARE @X SQL_VARIANTset @X=10SET @ret=select SQL_VARIANT_PROPERTY(@X,'BaseType')Just trying to assign the SQL_VARIANT_PROPERTY return value to @ret and it issues an error: Implicit conversion from data type sql_variant to varchar is not allowed. Use the CONVERT function to run this query.But I don't want to convert I just want to assign the result to the variable. what's confusding is that you can do this: if(select SQL_VARIANT_PROPERTY(@X,'BaseType'))='int'So I assume I should b able to do the above.--PhB |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-01-31 : 16:49:17
|
| [code]declare @ret varchar(50)DECLARE @X SQL_VARIANTset @X = 10select @ret = cast(SQL_VARIANT_PROPERTY(@X, 'BaseType') as varchar)select @ret[/code]Peter LarssonHelsingborg, Sweden |
 |
|
|
|
|
|