Consider the following T-SQL code snippet:
CREATE PROC dbo.SquareNum(@i INT OUTPUT)
AS
BEGIN
SET @i = @i * @i
--SELECT @i
END
GO
DECLARE @a INT = 3, @b INT = 5
EXEC dbo.SquareNum @a OUTPUT
EXEC dbo.SquareNum @b
SELECT @a AS ASQUARE, @b AS BSQUARE
GO
DROP PROC dbo.SquareNum
The result set is:
ASQUARE BSQUARE
----------- -----------
9 5
As can be seen, @b
is not squared, b/c it was not passed-in as output parameter (no OUTPUT
qualifier when passing in the parameter).
I would like to know if there is a way I could check within stored procedure body (dbo.SquareNum body in this case) to see if a parameter has indeed been passed in as an OUTPUT
parameter?