set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
goALTER procedure [dbo].[proc_Approve]
@uid int,
@money float,
@appid int,
@remitHistoryId int
as
update RemitHistory set ApproveState=@appid where RemitHistoryId=@remitHistoryId
update UserInfo set UMoney=@money where UID=@uid
go
set QUOTED_IDENTIFIER ON
goALTER procedure [dbo].[proc_Approve]
@uid int,
@money float,
@appid int,
@remitHistoryId int
as
update RemitHistory set ApproveState=@appid where RemitHistoryId=@remitHistoryId
update UserInfo set UMoney=@money where UID=@uid
go
begin
update RemitHistory set ApproveState=@appid where RemitHistoryId=@remitHistoryId
update UserInfo set UMoney=@money where UID=@uid
end
go
@uid int,
@money float,
@appid int,
@remitHistoryId int
as
declare @err int
set @err=0
begin tran
update RemitHistory set ApproveState=@appid where RemitHistoryId=@remitHistoryId
set @err=@err+abs(@@error)
update UserInfo set UMoney=@money where UID=@uid
set @err=@err+abs(@@error)
if @err <>0
rollback
else
commit
go
保持數據一致性
所有上csdn来问问的,果然还是要用事物的。