I need to include several stored procedure in a single transaction in a single database, if any of stored procedure fail then roll back transaction of all stored procedure procesed in the scope.
I work with SQL-SERVER 2008
begin transaction
begin try
  exec proc_1
  exec proc_2
  exec proc_3
  commit transaction
end try
begin catch
  rollback transaction
end catch
You can create a single stored procedure that starts a transaction and then calls the other stored procedures. If any of the inner stored procedures fail you can rollback the transaction. If you tell us what database platform you're using (MS SQL Server, MySQL, etc.) people may be able to provide more specific solutions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With