I have a procedure dbo.pX
that returns a table with 1 field named id
and an INT
in it, that can be equal to 0, or another positive integer. I need to insert this id
in a variable inside a procedure named dbo.pY
, to verify if the id
is greater than 0.
Procedure dbo.pX
:
CREATE PROCEDURE dbo.pX
@param1 VARCHAR(30)
AS
DECLARE @id INT;
-- Some code to change the @id
SELECT @id AS 'id';
GO
What I tried to do in dbo.pY
:
CREATE PROCEDURE dbo.pY
@param1 VARCHAR(30)
AS
DECLARE @ret INT;
SET @ret = (EXECUTE dbo.pX 'something');
IF ( @ret > 0 ) BEGIN
-- Some code that uses @ret
END
GO
Any tips or hints to help me find a way to solve it?
Obs: I can't change the procedure dbo.pX
.