SQLTeam.com | Weblogs | Forums

Stored Procedure with Output parameter

#1

I am trying to create a stored procedure with an output parameter but keep getting an error when I run it that indicates that second parameter is missing:

ALTER PROCEDURE spVerifySupervisor
@Supervisor varchar(50).
@Result varchar(50)
AS
BEGIN
SET NOCOUNT ON;
DECLARE @ID int;

SELECT @ID = id FROM tblSupervisor
WHERE novel_id = @Supervisor;

IF ((SELECT @ID) >= 0)
SET @Result = "TRUE";
ELSE
SET @Result = 'FALSE';

END

I get expects parameter "@Result", which was not supplied.
HELP

0 Likes

#2

--when creating proc
CREATE PROCEDURE ...
...
@Result varchar(50) = NULL OUTPUT
...

--when executing proc
DECLARE @Result_back varchar(50)
EXEC dbo.spVerifySupervisor 'Supervisor1', @Result = @Result_back OUTPUT

0 Likes

#3

I will try that...thank you!

0 Likes