If a stored procedure contains multiple statements e.g. first an insert
, then an update
and finally a delete
s and the stored procedure gets killed in the middle of the delete
, does the insert
and update
also have to be rolled back? Or does it only roll back the delete
i.e. the implicit transaction?
As explained in Transactions, each statement will be executed as an implicit transaction. If a statement fails then the effect of prior statements will remain committed.
Note that the entire stored procedure may be executed within an explicit transaction created by the calling code.