34,593
社区成员
发帖
与我相关
我的任务
分享
CREATE PROCEDURE P1
--定义P1参数
...
AS
--P1的其他判断SQL
.....
BEGIN TRAN
P2(@P2参数1);
P2(@P2参数2);
P2(@P2参数3);
COMMIT TRAN
create table t1(id int,name varchar(10))
create table t2(id int,name varchar(10))
create proc p_innerProcTest
as
begin
begin try
begin tran
insert into t1 values(1,'A');
if exists(select 1 from t1 where id=1)
begin tran
insert into t1 values(1,'ABCDEFGHIJKLMN');--执行失败,
commit
commit
end try
begin catch
rollback;
end catch
end
EXEC p_innerProcTest
SELECT * FROM t1
select * from t2