我的代码如下:
create my sp
as
declare cursor
open cursor
fetch next from
begin try
begin transaction tran1
exec sp_1....
commit transaction tran1
select * from table
begin transaction tran2
exec sp_2....
commit transaction tran2
end
fetch next from cursor
end try
begin catch
SELECT ERROR_MESSAGE() AS ErrorMessage;
IF @@TRANCOUNT > 0
ROLLBACK TRAN;
fetch next from cursor
end catch
close cursor
deallocate cursor
我需要这段代码:
我认为catch部分可能不对,因为有两个事务需要具体。