Sunday, 8 September 2013

Creating Stored Procedure Queries

1. Insert Query

ALTER PROCEDURE dbo.insert_Employee


@EmpName nvarchar(50),@EmpAddress nvarchar(50),@EmpPhone nvarchar(50),@EmpMobile nvarchar(50),@EmpSalary nvarchar(50),@EmpPassport nvarchar(50)

AS


insert into Employee values(@EmpName,@EmpAddress,@EmpPhone,@EmpMobile,@EmpSalary,@EmpPassport)


RETURN


2. Select Query

ALTER PROCEDURE dbo.Select_Employee


AS

select * from Employee


RETURN


3. Delete Query


ALTER PROCEDURE dbo.Delete_Employee
@EmpID bigint

AS

delete from Employee where EmpID=@EmpID

RETURN

4. Update Query

ALTER PROCEDURE dbo.update_Employee
@EmpName nvarchar(50),@EmpAddress nvarchar(50),@EmpPhone nvarchar(50),@EmpMobile nvarchar(50),@EmpSalary nvarchar(50),@EmpPassport nvarchar(50),@EmpID bigint

AS

update Employee set EmpName=@EmpName,EmpAddress=@EmpAddress,EmpPhone=@EmpPhone,EmpMobile=@EmpMobile,Empsalary=@EmpSalary,EmpPassport=@EmpPassport
where EmpID=@EmpID

RETURN

No comments:

Post a Comment

Thanks

SQL server tricky questions