In SQL Server, you can return multiple output parameters from a stored procedure using the OUTPUT
keyword for each output parameter. Here is an example of how to do this:
ALTER PROCEDURE myStoredProcedure
@inputParam1 INT,
@inputParam2 VARCHAR(50),
@outputParam1 INT OUTPUT,
@outputParam2 VARCHAR(50) OUTPUT
AS
BEGIN
-- your stored procedure code here
SET @outputParam1 = 12345
SET @outputParam2 = 'Hello World'
END
DECLARE @output1 INT
DECLARE @output2 VARCHAR(50)
EXEC myStoredProcedure 1, 'input2', @output1 OUTPUT, @output2 OUTPUT
SELECT @output1 AS 'Output 1', @output2 AS 'Output 2'
No hay comentarios:
Publicar un comentario