My question is, if a transaction contains a call to a store procedure that inserts data into a table and this procdure then calls another store procedure to update another table.
Will the entire transaction be rolled back if the insert or update fails in either nested stored procedure?
This is the code in the main store procedure. It executes stored procedure #1, stored procedure #1, executes store procedure#2.
BEGIN TRAN
EXEC(@@InputString) -- Execute the sp1
IF @@ERROR <> 0
Begin
--RAISERROR 50000
ROLLBACK TRAN
GOTO end_of_batch
END
COMMIT TRAN
Thanks in Advance!
Greg
Will the entire transaction be rolled back if the insert or update fails in either nested stored procedure?
This is the code in the main store procedure. It executes stored procedure #1, stored procedure #1, executes store procedure#2.
BEGIN TRAN
EXEC(@@InputString) -- Execute the sp1
IF @@ERROR <> 0
Begin
--RAISERROR 50000
ROLLBACK TRAN
GOTO end_of_batch
END
COMMIT TRAN
Thanks in Advance!
Greg