Stored procedure with output parameters vs. table-valued function?
Posted
by abatishchev
on Stack Overflow
See other posts from Stack Overflow
or by abatishchev
Published on 2010-03-28T14:15:38Z
Indexed on
2010/03/28
14:23 UTC
Read the original article
Hit count: 233
Which approach is better to use if I need a member (sp or func) returning 2 parameters:
CREATE PROCEDURE Test
@in INT,
@outID INT OUT,
@amount DECIMAL OUT
AS
BEGIN
...
END
or
CREATE FUNCTION Test
(
@in INT
)
RETURNS @ret TABLE (outID INT, amount DECIMAL)
AS
BEGIN
...
END
What are pros and cons of each approach considering that the result will passed to another stored procedure:
EXEC Foobar @outID, @outAmount
© Stack Overflow or respective owner