The distributed transactions started in Transact-SQL have a relatively simple structure:
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:
For any Transact-SQL distributed transaction, the SQL Server processing the Transact-SQL script or connection automatically calls MS DTC to coordinate the commitment or rollback of the transaction.
You can start distributed transactions in Transact-SQL in these ways:
You can also execute a distributed query against a linked server. The SQL Server you have connected to calls MS DTC to manage the distributed transaction with the linked server. You can also call remote stored procedures on a remote SQL Server as part of the distributed transaction.
If the OLE DB data source supports the ITransactionJoin interface, the transaction is promoted to a distributed transaction, even if the query is a read-only query. If the data source does not support ITransactionJoin, only read-only statements are allowed.
SQL Server uses MS DTC to coordinate the transaction with the remote server.
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.
BEGIN DISTRIBUTED TRANSACTION | ROLLBACK TRANSACTION |
COMMIT TRANSACTION | ROLLBACK WORK |
COMMIT WORK | SET REMOTE_PROC_TRANSACTIONS |