存储过程的操作

 

添加

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值