Got a couple of tables called PARAM_NVARCHAR100, PARAM_INT, PARAM_DATETIME. They all have columns "id" and "parameterdata", however the difference is that parameterdata is INT, NVARCHAR100 or DATETIME depending on tablename.
I am now trying to make a procedure that takes a sql_variant and inserts data to relevant table, and so heres the problem when its NVARCHAR100 table: "Implicit conversion from data type sql_variant to nvarchar is not allowed. Use the CONVERT function to run this query."
Anyone has an idea how to solve below sql to make it work?
SET @sql = 'insert into '+@tablename+' (parameterdata) values(@paramvalue) '+ 'set @returnid = SCOPE_IDENTITY()'
EXEC sp_executesql @sql, N'@returnid bigint output, @paramvalue sql_variant',