Step1:- Create Temp Table
create table #EmployeeTable
(
EmployeeId int identity,
Employee_Name varchar(50)
)
insert into #EmployeeTable
select 'Ram' union all
select 'Shyam' union all
select 'Ghanshyam' union all
select 'Seeta' union all
select 'Radha'
select * from #EmployeeTable
Step 2:- Create Store Procedure
CREATE PROCEDURE GetEmployeeName
@EmployeeID INT,
@EmployeeName VARCHAR(50) OUTPUT
AS
BEGIN
Select @EmployeeName = Employee_Name
from #EmployeeTable
where EmployeeId=@EmployeeID
END
Step3:- Test the Store Procedure
DECLARE @EmployeeName varchar(50)
EXECUTE GetEmployeeName 3, @EmployeeName output
SELECT @EmployeeName
No comments:
Post a Comment