Eg: Creating for Employee Records
Create Procedure Procedure name
(@action char(1),@Empid varchar(10),@Empname varchar(25),@Age int,@Sal int,@Address varchar(50)
as
begin
if(@action='i') //i=insert
insert into tblemp (@Empid,@Empname,@Age,@Sal,@Address) values(Empid,Empname,Age,Sal,Address)
end
begin
if(@action='u')//update
update tblemp @Emp=Emp and @Age=Age and @Sal=sal where @Empid=Empid
end
begin
if(@action='s')//select
Select * from tblemp
end