Hi,
I have the following string:
set @sqlstr = 'Select ordering from ' + @table + ' where [id] = ' + cast(@id as nvarchar(10))
that I want to execute and get the return value of, putting it into a variable. How can I do this? I execute the string like this exec(@sqlstr) but get not return value. And as far as I know I have to do it this way because a normal select statement won't work since I need to put two variable values into it.
Does anyone know how to do this? Thanks.
I have the following string:
set @sqlstr = 'Select ordering from ' + @table + ' where [id] = ' + cast(@id as nvarchar(10))
that I want to execute and get the return value of, putting it into a variable. How can I do this? I execute the string like this exec(@sqlstr) but get not return value. And as far as I know I have to do it this way because a normal select statement won't work since I need to put two variable values into it.
Does anyone know how to do this? Thanks.