As you can see from the definition you provided for [dbo].[ConfigData], both Value
and ValueInUse
are defined as SQL_VARIANT
data types. The error message you are receiving is:
Msg 257, Level 16, State 3, Procedure usp_SysConfigReport1, Line 19 Implicit conversion from data type sql_variant to int is not allowed. Use the CONVERT function to run this query.
So Value
and ValueInUse
are SQL_VARIANT
(as also are the derived values for OlderValue
, OlderValueInUse
, RecentValue
, and RecentValueInUse
) but you want to use them as INT
.
The error message is saying that you need to change the SQL_VARIANT
into INT by using the CONVERT
function. An example of selecting a SQL_VARIANT
and turning it into an INT
.
SELECT CONVERT (int, Value}) FROM [dbo].[ConfigData]
The CONVERT
changes the datatype (if possible) from SQL_VARIANT
to INT
.
Just make sure to CONVERT
to the proper data type and all should be well.