Is there a way to convert @my_variable
string into a value of @my_variable
?
I have a table which stores names of variables. I need to get the value of this variable. Something like this:
DECLARE @second_variable AS NVARCHAR(20);
DECLARE @first_variable AS NVARCHAR(20);
SET @first_variable = '20';
SET @second_variable = SELECT '@first_variable'; --here I want that @second variable be assigned a value of "20".
The most likely solution to your problem is to address/change/fix the design that requires why you would have a table that stores the names of variables.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With