34,838
社区成员




create procedure sp_test_A(
@id int=null
)
as
if @@trancount=0
begin transaction A
else
save transaction A
insert t_test_A values(@id)
if @@error<>0 goto transA
insert t_test_A values(888)
if @@error<>0 goto transA
if @@error<>0
begin
transA:
rollback tran A
end
else
commit tran A
go
create procedure sp_test_B as
begin tran B
insert t_test_A values(666)
if @@error<>0 goto transB
execute sp_test_A
if @@error<>0 goto transB
if @@error<>0
begin
transB:
rollback tran B
end
else
commit tran B
go