Passing MS SQL Sproc result into a variable
Date: 06/26/06
(Web Development) Keywords: no keywords
I am returning a certian value from my stored procedure and i need to get this value from the stored procedure to into a variable for use in a if statement. Code is below.
-- sproc calls the last stock take count EXEC @last_stk = sp_get_last_archived_stock @location_id, @product_code
-- if the stock take is null set the salesorder number to -- The maximum stock count minus the current stock take value -- or else take current stock take from last stock take to -- find out how many to invoice. BEGIN IF @last_stk IS NULL OR @last_stk = '' SET @salesorder = @max_stk - @curr_stock ELSE SET @salesorder = @last_stk - @curr_stock END
Source: http://community.livejournal.com/webdev/331101.html
|