it isn't liking me concatening the sql_variant... in my app i have a dropdown list of fields, and they are tagged with their sqldbtypes... and i got everything handled over there if i can get this part of the query working... i'm not sure i can just cast the sql_variant to an nvarchar and the query will still work as i expect it to... i hope it will work for fields that are bits, ints, datetimes, nvarchars, etc....
As you can guess... @value is the sql_variant...
Set @command =
'Select Row_Number() Over(ORDER BY nameCompany) as Row,
Where ' + @fieldName + '= ' + @value;