Wrox Programmer Forums
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 21st, 2006, 05:32 AM
Registered User
 
Join Date: Feb 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Help!!!

Hi all.

As I know, SQL Server allow to have nested transactions.
I want to understand how it works.
If I have something like this:

Begin Transaction
Begin Transaction \\1
     Do something1
Commit Transaction

Begin Transaction \\2
     Do something2
Commit Transaction

Commit Transaction

I have two nested transaction at the same level.
They will be executed sequentially or concurrently?
Is there any possibility to execute nested transactions concurrently?

Thanks in advance.
 
Old February 21st, 2006, 10:27 AM
SQLScott's Avatar
Wrox Author
 
Join Date: Dec 2004
Posts: 338
Thanks: 0
Thanked 2 Times in 2 Posts
Default

are you on SQL Server 2000 or 2005? From teh 2005 BOL, it states:

Committing inner transactions is ignored by the SQL Server Database Engine. The transaction is either committed or rolled back based on the action taken at the end of the outermost transaction. If the outer transaction is committed, the inner nested transactions are also committed. If the outer transaction is rolled back, then all inner transactions are also rolled back, regardless of whether or not the inner transactions were individually committed.

Each call to COMMIT TRANSACTION or COMMIT WORK applies to the last executed BEGIN TRANSACTION. If the BEGIN TRANSACTION statements are nested, then a COMMIT statement applies only to the last nested transaction, which is the innermost transaction. Even if a COMMIT TRANSACTION transaction_name statement within a nested transaction refers to the transaction name of the outer transaction, the commit applies only to the innermost transaction.



 
Old February 21st, 2006, 11:08 AM
Registered User
 
Join Date: Feb 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Sorry, probably my question was not so cleare.

The problem is this:

Consider, there is a tree, where there is a root which has two children (this is a transaction which has a two nested subtransactions). Now, this children can be executed concurrently, independently from each other, or first will be executed one and than another?
The version of SQL Server is not important.

Thanks in advance.










Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.