存储过程

use TEST

go

if exists(select * from sysobjects where name='sp_query_bankMoney')

drop procedure sp_query_bankMoney

go

create procedure sp_query_bankMoney

as

select * from bankMoney

go

execute sp_query_bankMoney

go

create proc insert_bank @id int,@userid nvarchar(50),@sex nchar(10),@bankmoney int,

@total int output

with encryption

as insert into bankMoney(id,userid,sex,bmoney) values(@id,@userid,@sex,@bankmoney) select @total=sum(bmoney)from bankMoney where userid='zhangsan' go

declare @total_price int 

exec insert_bank '004','Zhangsan','男',100,@total_price output     

print '总余额为'+convert(varchar,@total_price) go 

posted @ 2016-07-06 15:46  恋之呓  阅读(132)  评论(0编辑  收藏  举报