这个存储过程什么意思?
如题:对存储过程比较熟的大侠帮我看看这个存储过程:
CREATE PROCEDURE [dbo].[pro_add_sms]
@entid as varchar(20),
@operatorid as int ,
@cmcontent as varchar(1000) ,
。
。
@rvalue as varchar(50) output,
@leftba as int output
as
declare @rowcount as int , @usertypeid as int , @entslimit as int , @usersmsbalance as int , @entssmsbalance as int , @error as int
begin
select @usertypeid=usertypeid , @usersmsbalance=balance from qmsg_admin where operatorid=@operatorid
set @error=@@error
if @error<>0
begin
set @rvalue='500'
goto end1
end
begin tran
if @usertypeid=0
begin
if @usersmsbalance >=@chargeCount
begin
update qmsg_admin set balance = balance - @chargeCount where operatorid=@operatorid
set @rowcount=@@rowcount
if @rowcount=0
begin
set @rvalue = '100'
rollback tran
goto end1
end
else
begin
set @leftba=@usersmsbalance-@chargeCount
end
end
end
commit tran
set @rvalue='0'
end
end1:
这是存储过程中的一些代码,省略了一部分
[解决办法]
更新出错返回500
未发生更新返回100
更新成功返回0
[解决办法]