Home > database >  Stored procedure execution problems
Stored procedure execution problems

Time:11-14

Begin the try
The begin tran

,,,

Commit tran
End the try



The begin catch
The set @ p_Flag=ERROR_MESSAGE ()
The rollback tran
Return
Print ERROR_MESSAGE ()
End the catch

Why the statement or perform before the error, how can rollback all operations after an error

CodePudding user response:

Try catch writing before submission in the stored procedure

CodePudding user response:

To set the xact_abort on, the following wording,
 
The set xact_abort on
Begin the try
The begin tran
[...].
Commit tran
End the try
The begin catch
The rollback tran
Print error_message ()
End the catch
  • Related