Sql Server nested transaction rollback @@TRANCOUNT -


i've got stored procedure begins new transaction data manipulation. procedure executed within transaction.
have no influence happens before procedure. , change.

my idea check @@trancount before begin nested transaction. check @@trancount again in catch block , compare it. in no case want outer transaction rollbacked. wonder if safe code?

thx help!

set @transcountbefore = @@trancount;  begin transaction tx; begin try   /* data manipulation here */   commit transaction tx;        end try             begin catch   if @@trancount > @transcountbefore rollback transaction tx;   /* error handling here */    end catch; 


Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -