07-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


文章来自: 本站原创
引用通告: 查看所有引用 | 我要引用此文章
Tags: SQL Server SQL存储过程
相关日志:
评论: 0 | 引用: 0 | 查看次数: 841
发表评论
昵 称:
密 码: 游客发言不需要密码.
内 容:
验证码: 验证码
选 项:
虽然发表评论不用注册,但是为了保护您的发言权,建议您注册帐号.
字数限制 1000 字 | UBB代码 开启 | [img]标签 关闭