Use output of procedure in a new procedure SQL Server

Viewed 18

I have a stored procedure that returns an output, ID. Say it works like tihs:

PROCEDURE IssuerID
   @ID INT OUTPUT

BEGIN

-- assigns a value to ID somehow

END

And now I am working with another stored procedure. In this procedure, I execute the stored procedure IssuerID, and I would like to use the output of IssuerID for something. I tried to do it like this:

PROCEDURE IssuerID2

BEGIN
   EXEC IssuerID

select top 1 ID from RandomTable where ID = (Output of EXEC IssuerID)
END

However, it did not work out. Any ideas?

0 Answers
Related