Transact-SQL Distributed Transactions

The distributed transactions started in Transact-SQL have a relatively simple structure:

  1. A Transact-SQL script or application connection executes a Transact-SQL statement that starts a distributed transaction.
  2. The Microsoft® SQL Server™ executing the statement becomes the controlling server in the transaction.
  3. The script or application then executes either distributed queries against linked servers or remote stored procedures against remote servers.
  4. As distributed queries and remote procedure calls are made, the controlling server automatically calls MS DTC to enlist the linked and remote servers in the distributed transaction.
  5. When the script or application issues either a COMMIT or ROLLBACK statement, the controlling SQL Server calls MS DTC to manage the two phase commit process, or to notify the linked and remote servers to roll back their transactions.
Required Transact-SQL Statements

The Transact-SQL statements controlling the distributed transactions are few because most of the work is done internally by Microsoft® SQL Server™ and MS DTC. The only Transact-SQL statements required in the Transact-SQL script or application are those required to:

Starting Distributed Transactions

You can start distributed transactions in Transact-SQL in these ways:

The REMOTE_PROC_TRANSACTIONS option is a compatibility option that affects only remote stored procedure calls made to remote servers defined using sp_addserver. For more information about remote stored procedures, see Remote Stored Procedure Architecture. The option does not apply to distributed queries that execute a stored procedure on a linked server defined using sp_addlinkedserver. For more information about distributed queries, see Distributed Queries.

See Also
BEGIN DISTRIBUTED TRANSACTION ROLLBACK TRANSACTION
COMMIT TRANSACTION ROLLBACK WORK
COMMIT WORK SET REMOTE_PROC_TRANSACTIONS

  


(c) 1988-98 Microsoft Corporation. All Rights Reserved.