begin tran
exec("storeprocedure1('2')")
if @.@.error=0
begin
exec("storeprocedure2")
if @.@.error=0
begin
exec("storeprocedure3(122)")
if @.error=0
commit tran
else
rollback tran
end
else
rollback tran
end
else
rollback transure, exec statements will work,
but your syntax is not correct, it should be like this:
begin tran
statement1if (@.@.error <> 0)
begin
rollback tran
return
endstatement2
if (@.@.error <> 0)
begin
rollback tran
return
endcommit tran
No comments:
Post a Comment