Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Nested transaction

Author  Topic 

deepakugale
Starting Member

33 Posts

Posted - 2010-03-02 : 01:25:01
Can i use transaction inside transaction in SP i.e. nested transaction?
And if yes , if inner transaction is committed but occures error in outer transaction ,will it rollback inner transaction's operation ?

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-03-02 : 03:34:21
In general:
Yes - you can use nested transactions.
A committed inner transaction will not make any changes permanent. It only will decrease @@TRANCOUNT.
Hence, the outer transaction can commit or rollback all changes in nested transactions.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

vaibhavktiwari83
Aged Yak Warrior

843 Posts

Posted - 2010-03-02 : 03:59:30
If inner transaction is commited then outer transaction commit will not take effect

Vabhav T
Go to Top of Page

vaibhavktiwari83
Aged Yak Warrior

843 Posts

Posted - 2010-03-02 : 04:00:09
means that can not be commited but can be rolled back

Vabhav T
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-03-02 : 04:03:01
quote:
Originally posted by vaibhavktiwari83

means that can not be commited but can be rolled back

Vabhav T


Are you saying that OUTER transactions cannot be commited once INNER transactions are committed?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-03-02 : 04:03:41
Sorry but that is wrong.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-03-02 : 04:04:15
see here:
http://msdn.microsoft.com/en-us/library/ms190295(SQL.90).aspx


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -