Hi all,
I am trying to assign a variable the result of a query in a stored procedure. At the moment, the line is:
select @reqid = (select o_reqid from swpro.staffo where o_casenum = @caseref)
The SP should then insert the variable into a concatenated string and wriet this string to another table. The actual result of the query is always one numeric value, but when I run the SP, the value written to the table is NULL. If I use SET instead of SELECT for the variable, no value is written to the table. I've read some posts on these forums regarding sp_executesql - do i need to use this?
I am trying to assign a variable the result of a query in a stored procedure. At the moment, the line is:
select @reqid = (select o_reqid from swpro.staffo where o_casenum = @caseref)
The SP should then insert the variable into a concatenated string and wriet this string to another table. The actual result of the query is always one numeric value, but when I run the SP, the value written to the table is NULL. If I use SET instead of SELECT for the variable, no value is written to the table. I've read some posts on these forums regarding sp_executesql - do i need to use this?