CREATE PROCEDURE ProcessValue
(
@value int,
@returnValue int OUTPUT
)
AS
BEGIN
/* do calculation and processing and assign the result value to output parameter */
SET @returnValue = value + 5*value
END
The following calling of the procedure shows how to get output parameter.
declare @result int
EXEC ProcessValue 15, @result OUTPUT
Of course this example is pretty simple - only for showing how to use. For such usage the SQL scalar-valued functions are better way.
No comments:
Post a Comment