I have created a simple stored procedure like this:
Alter Proc dbo.s5
(
@id int = 14,
@Salary int output
)
As
Begin
--Declare @Salary int
set @Salary = (select Salary
from dbo.EmpInf
where EmpId = @id)
print @Salary
--Return @Salary
End
During execution of this stored procedure, I get this error:
Msg 201, Level 16, State 4, Procedure s5, Line 0
Procedure or function ‘s5’ expects parameter ‘@Salary’, which was not supplied.
What am I doing wrong?
You need to supply the @Salary variable as input variable to your stored proc even though it is marked as an output parameter.
As can be read in the following link: