Create Stored Procedure

Hariinakoti
Posted by Hariinakoti under Sql Server category on | Points: 40 | Views : 1217
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

Comments or Responses

Posted by: Hariinakoti on: 9/14/2012 Level:Starter | Status: [Member] | Points: 10
how to write stored procedure in another way and how to wrote storedprocedure in functions?
Plz reply.

Login to post response