添加
use db_guo
go
if exists(select name from sysobjects where name='proc_insert' and type='p')
drop proc proc_insert
go
create proc proc_insert
(
@login_id
@login_name varchar(20)=null,
@login_pwd varchar(20)=null,
@proc_info varchar(20) outprt
)
as
begin
select @login_id=Max(login_id) from tb_login
if(@login_id is null)
set @login_id ='log1001'
else
set @login_id='log'+cast(cast(substring(@loginid,4,4)as int)+1 as varchar(20))
if exists(select login_name from tb_login where login_name=@login_name)
set @proc_info='isHave'--控制不要输入相同的信息
else
begin
inset into tb_login values(@login_id,@login_name,@login_pwd)
set @proc_info='ok'
end
end
go
修改
use db_guo
go
if exists(select name from sysobjects where name='proc_update' and type='p')
drop proc proc_update
go
create proc proc_update
(
@login_id varchar(10)=null,
@login_name varchar(20)='',
@login_pwd varchar(20)=''
)
as
begin
update tb_login set login_name=@login_name,login_pwd=@login_pwd
where login_id=@login_id
end
go
删除
use db_guo
go
if exists(select name from sysobjects where name='proc_delete' and type='p')
drop proc proc_delete
go
create proc proc_delete
(
@login_id varchar(10)=null
)
as
begin
delete from tb_login where login_id=@login_id
end
go