07-06
08
存储过程实例 (人事部门管理系统)
作者:Java伴侣 日期:2007-06-08
1.添加部门
Create PROCEDURE demo_deptadd
@name varchar(20),@description varchar(20),@leader varchar(20),@phone varchar(20),
@address varchar(20),@starttime varchar(20),@info varchar(40)
AS
insert into department
(name,description,leader,phone,address,starttime,info)values
(@name,@description,@leader,@phone,@address,@starttime,@info)
GO
2.更新部门信息
Create PROCEDURE demo_deptupdate
@name varchar(20),
@description varchar(20),
@leader varchar(20),
@phone varchar(20),
@address varchar(20),
@starttime varchar(20),
@info varchar(40),
@id int
AS
update department set name=@name,description=@description,leader=@leader,phone=@phone,
address=@address,starttime=@starttime,info=@info where id=@id
GO
3.添加雇员
Create PROCEDURE demo_empadd
@inparam1 varchar(10),@inparam2 varchar(20),@inparam3 int,
@inparam4 varchar(10),@inparam5 varchar(20),@inparam6 varchar(10),
@inparam7 varchar(20),
@inparam8 varchar(10),@inparam9 varchar(40)
AS insert into employee(name,sex,age,salary,department,marriage,address,phone,resume)values
(@inparam1,@inparam2,@inparam3,@inparam4,@inparam5,@inparam6,@inparam7,@inparam8,@inparam9)
GO
4.更新雇员信息
Create PROCEDURE demo_empupdate
@name varchar(10),
@sex varchar(20),
@age int,
@salary varchar(10),
@department varchar(20),
@marriage varchar(10),
@address varchar(20),
@phone varchar(10),
@resume varchar(40),
@id int
AS
update employee set name=@name,sex=@sex,
age=@age,salary=@salary,department=@department,
marriage=@marriage,address=@address,phone=@phone,resume=@resume
where id=@id
GO
复制内容到剪贴板 程序代码
Create PROCEDURE demo_deptadd
@name varchar(20),@description varchar(20),@leader varchar(20),@phone varchar(20),
@address varchar(20),@starttime varchar(20),@info varchar(40)
AS
insert into department
(name,description,leader,phone,address,starttime,info)values
(@name,@description,@leader,@phone,@address,@starttime,@info)
GO
2.更新部门信息
复制内容到剪贴板 程序代码
Create PROCEDURE demo_deptupdate
@name varchar(20),
@description varchar(20),
@leader varchar(20),
@phone varchar(20),
@address varchar(20),
@starttime varchar(20),
@info varchar(40),
@id int
AS
update department set name=@name,description=@description,leader=@leader,phone=@phone,
address=@address,starttime=@starttime,info=@info where id=@id
GO
3.添加雇员
复制内容到剪贴板 程序代码
Create PROCEDURE demo_empadd
@inparam1 varchar(10),@inparam2 varchar(20),@inparam3 int,
@inparam4 varchar(10),@inparam5 varchar(20),@inparam6 varchar(10),
@inparam7 varchar(20),
@inparam8 varchar(10),@inparam9 varchar(40)
AS insert into employee(name,sex,age,salary,department,marriage,address,phone,resume)values
(@inparam1,@inparam2,@inparam3,@inparam4,@inparam5,@inparam6,@inparam7,@inparam8,@inparam9)
GO
4.更新雇员信息
复制内容到剪贴板 程序代码
Create PROCEDURE demo_empupdate
@name varchar(10),
@sex varchar(20),
@age int,
@salary varchar(10),
@department varchar(20),
@marriage varchar(10),
@address varchar(20),
@phone varchar(10),
@resume varchar(40),
@id int
AS
update employee set name=@name,sex=@sex,
age=@age,salary=@salary,department=@department,
marriage=@marriage,address=@address,phone=@phone,resume=@resume
where id=@id
GO
评论: 0 | 引用: 0 | 查看次数: 838
发表评论