我有两个存储过程,我从另一个存储过程调用一个存储过程,在两个存储过程中我使用事务。以下是存储过程,
CREATE PROCEDURE [dbo].[spOuter]
AS
BEGIN
begin tran t1
-- some sql queries..
Exec spInner;
commit tran t1
END
CREATE PROCEDURE [dbo].[spInner]
AS
BEGIN
begin tran t2
– some sql queries.
rollback tran t2
END
但执行此操作时,它会显示错误,如下所示:
Cannot roll back t2. No transaction or savepoint of that name was found.
有人可以解释为什么会出现这种情况吗?
答案 0 :(得分:1)