Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Variable assigned NULL

Status
Not open for further replies.

krisboy

Technical User
Mar 4, 2002
16
0
0
AU
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?
 
It's now sorted - and works exactly as it should.
Eventually got this working with the help of CONVERT... (hides embarrassment).

Thanks anyway!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top