-- Collection of code snippets by Arne Vajhøj 
-- (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) 
CREATE PROCEDURE usp_return @inarg INTEGER, @outarg INTEGER OUT
AS
BEGIN
    SELECT @inarg+1 AS v
    SELECT @outarg = @inarg+2 
    RETURN @inarg+3
END;
GO
DECLARE @rv INTEGER;
DECLARE @ov INTEGER;
EXEC @rv = dbo.usp_return 3, @ov OUT;
SELECT @rv AS rv,@ov AS ov;
GO
DROP PROCEDURE usp_return;
GO
