I am calling a stored procedure (that I can't modify) that returns a single value via a SELECT
at the end of the procedure. I need to use that value in my own procedure. How can I get that value?
Here is an example of the procedure I am calling that I can not modify:
CREATE PROCEDURE [dbo].[SP_poorlywritten] (
....
)
BEGIN
....
SELECT @lastkey;
RETURN (0);
END
And here is what I am trying to do, but it doesn't work because this gets the return value, and what I need is that SELECT
value:
exec @next_key = SP_poorlywritten 'tablename',1;
How can I store the first column, first row value from a store procedure?