Can I use the results of one stored procedure in another stored procedure?
those.
CREATE PROCEDURE [dbo].[Proc1]
@ID INT,
@mfgID INT,
@DealerID INT
AS
BEGIN
DECLARE @Proc1Result UserDefinedTableVariable
EXEC @Proc1Result = Proc2
@SomeID = @ID,
@SomeID2 = @mfgID,
@SomeID3 = @DealerID
SELECT [col1],[col2] FROM @Proc1Result
END
I tried to use INSERT INTO @Proc1Result EXEC Proc2 (with parameters passed), but INSERT EXECcannot be called in a nested expression.
Is there any way to do this? The environment is SQL Server 2008.
source
share