Home > database >  Can a stored procedure has multiple transactions?
Can a stored procedure has multiple transactions?

Time:11-22

The begin tran trProc
If the exists (select top 1 errorcount From # tempResult where errorcount=1 order by id DESC)
The begin
The rollback tran trProc
return;
End

If the exists (select top 1 errorcount From # tempResult where errorcount=1 order by id DESC)
The begin
The rollback tran trProc
return;
End
Commit tran trProc;

The begin tran trProc2
If the exists (select top 1 errorcount From # tempResult where errorcount=1 order by id DESC)
The begin
The rollback tran trProc2
return;
End

If the exists (select top 1 errorcount From # tempResult where errorcount=1 order by id DESC)
The begin
The rollback tran trProc2
return;
End
Commit tran trProc2;

CodePudding user response:

Allowed, in principle, try to use short, concise design,

CodePudding user response:

But in stored procedures used, is this a nested transaction?
  • Related