How can I write a procedure so that I can rollback all the INSERT, UPDATE, and DELETE statements whenever the ANY statement has an error.
Please note that my procedure may not have the operators listed in the sequence. In other words, I have INSERT statements, then IF logic, select statement, then another INSERT, then UPDATE, followed by logic, DELETE statement, etc.
I just want ROLLBACK all INSERT, UPDATE and DELETE statements if an error occurred for any statement. I found this code http://msdn.microsoft.com/en-us/library/ms181299.aspx and http://en.allexperts.com/q/MS-SQL-Server-1801/Rollback-SP.htm
But they do not answer my question.
source
share