So hello all!
I'm learning about stored procedures. Right now, I'm in the process of creating two of them, but having trouble with the syntax (I'm guessing).
So, first I have this one stored procedure:
Let me explain what I'm trying to do here. getEmpIDAndSSNFromHR will receive one parameter, the @SSN one. The @EmpID is suppose to store the employee ID and return it (it's an output variable) to another stored procedure.
The other stored procedure will take the emplid from this one and use it as an argument.
When I try to execute the procedure, I get an error:
Error: Procedure 'getEmpIDAndSSNFromHR' expects parameter '@EmpID', which was not supplied.
I've tried doing this, but keep receiving a syntax error:
I'm intentionally not including the 2nd procedure so I don't confuse anyone. I'll do it if I run into any problems.
Why is it it complaining? I'm pretty new to this and appreciate any help.
I'm learning about stored procedures. Right now, I'm in the process of creating two of them, but having trouble with the syntax (I'm guessing).
So, first I have this one stored procedure:
Code:
CREATE PROCEDURE dbo.getEmpIDAndSSNFromHR
@SSN char(9),
@EmpID char(4) OUTPUT
AS
select @EmpID = e.emplid
from hr.dbo.tblemployee e
where e.ssn = @SSN
GO
Let me explain what I'm trying to do here. getEmpIDAndSSNFromHR will receive one parameter, the @SSN one. The @EmpID is suppose to store the employee ID and return it (it's an output variable) to another stored procedure.
The other stored procedure will take the emplid from this one and use it as an argument.
When I try to execute the procedure, I get an error:
Code:
execute getEmpIDAndSSNFromHR '012345678'
Error: Procedure 'getEmpIDAndSSNFromHR' expects parameter '@EmpID', which was not supplied.
I've tried doing this, but keep receiving a syntax error:
Code:
DECLARE @var char(4);
execute getEmpIDAndSSNFromHR '012345678' '@var'
I'm intentionally not including the 2nd procedure so I don't confuse anyone. I'll do it if I run into any problems.
Why is it it complaining? I'm pretty new to this and appreciate any help.