SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Fun with Transactions - Part I


Fun with Transactions - Part I

Author
Message
Cliff Jones
Cliff Jones
SSCertifiable
SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)

Group: General Forum Members
Points: 5133 Visits: 3648
Good question, thanks.
UMG Developer
UMG Developer
Hall of Fame
Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)

Group: General Forum Members
Points: 3900 Visits: 2204
Nice question and discussion, thanks!
Daniel Bowlin
Daniel Bowlin
SSCertifiable
SSCertifiable (7.6K reputation)SSCertifiable (7.6K reputation)SSCertifiable (7.6K reputation)SSCertifiable (7.6K reputation)SSCertifiable (7.6K reputation)SSCertifiable (7.6K reputation)SSCertifiable (7.6K reputation)SSCertifiable (7.6K reputation)

Group: General Forum Members
Points: 7606 Visits: 2629
QoTD keeping us on our toes. Nice question, thanks.
mtassin
mtassin
SSCertifiable
SSCertifiable (7K reputation)SSCertifiable (7K reputation)SSCertifiable (7K reputation)SSCertifiable (7K reputation)SSCertifiable (7K reputation)SSCertifiable (7K reputation)SSCertifiable (7K reputation)SSCertifiable (7K reputation)

Group: General Forum Members
Points: 7040 Visits: 72521
I don't even know how excitingly appropriate this is.

Yesterday I learned about savepoints. Today a trigger that was invoking a stored procedure that created an inner transaction and rolled it back if a test case was pushed into production.

Nobody could figure out why the table with the tirgger was never getting a record.

Stuck in a transaction save point right after the BEGIN TRANSACTION in the stored proc and set the ROLLBACK to rollback to the savepoint and made the problem go away.

Awesome



--Mark Tassin
MCITP - SQL Server DBA
Proud member of the Anti-RBAR alliance.
For help with Performance click this link
For tips on how to post your problems
Nakul Vachhrajani
Nakul Vachhrajani
Hall of Fame
Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)

Group: General Forum Members
Points: 3208 Visits: 2149
mtassin (9/15/2010)
I don't even know how excitingly appropriate this is.

Yesterday I learned about savepoints. Today a trigger that was invoking a stored procedure that created an inner transaction and rolled it back if a test case was pushed into production.

Nobody could figure out why the table with the tirgger was never getting a record.

Stuck in a transaction save point right after the BEGIN TRANSACTION in the stored proc and set the ROLLBACK to rollback to the savepoint and made the problem go away.

Awesome


Hey, Mark!

That's really good to know!

Coincidence is a great phenomenon - I wonder how they happen?

Have a wonderful rest-of-the-week ahead!

Thanks & Regards,
Nakul Vachhrajani.
http://nakulvachhrajani.com
Be courteous. Drive responsibly.

Follow me on
Twitter: @sqltwins
Google Plus: +Nakul
mtassin
mtassin
SSCertifiable
SSCertifiable (7K reputation)SSCertifiable (7K reputation)SSCertifiable (7K reputation)SSCertifiable (7K reputation)SSCertifiable (7K reputation)SSCertifiable (7K reputation)SSCertifiable (7K reputation)SSCertifiable (7K reputation)

Group: General Forum Members
Points: 7040 Visits: 72521
Nakul Vachhrajani (9/15/2010)


Hey, Mark!

That's really good to know!

Coincidence is a great phenomenon - I wonder how they happen?

Have a wonderful rest-of-the-week ahead!


For me,

around here this happens about once every 3 months.

But usually I learn about it 2-3 weeks before I need to use it.. not 24 hours Smile

Tally Tables, Dynamic Paramterized Queries and several other topics typically hit here about 3 weeks before I need them. This time it was in a QOTD.

As I said, awesome.



--Mark Tassin
MCITP - SQL Server DBA
Proud member of the Anti-RBAR alliance.
For help with Performance click this link
For tips on how to post your problems
Tom Thomson
Tom Thomson
One Orange Chip
One Orange Chip (25K reputation)One Orange Chip (25K reputation)One Orange Chip (25K reputation)One Orange Chip (25K reputation)One Orange Chip (25K reputation)One Orange Chip (25K reputation)One Orange Chip (25K reputation)One Orange Chip (25K reputation)

Group: General Forum Members
Points: 25130 Visits: 12484
da-zero (9/14/2010)
[quote]Nesting does work with transactions. It's just that if you use rollback transaction, then all open transactions are rolled back. If you commit a transaction, then only the innermost transaction is committed.


No, you can't commit an inner transaction - what happens when you issue a commit command is that the transaction count gets decremented, and if the result is zero, the transaction (which is the outermost transaction) is committed (and the data modifications affected by this commit include all made by any so-called nested transactions); if the result is non-zero, nothing is committed. Neither can you roll back a nested transaction - you can only roll back the whole nest (including the outermost transaction).

Tom

Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search