Skip to content

Latest commit

 

History

History
65 lines (48 loc) · 4.47 KB

set-remote-proc-transactions-transact-sql.md

File metadata and controls

65 lines (48 loc) · 4.47 KB
title description author ms.author ms.date ms.service ms.subservice ms.topic f1_keywords helpviewer_keywords dev_langs
SET REMOTE_PROC_TRANSACTIONS (Transact-SQL)
SET REMOTE_PROC_TRANSACTIONS (Transact-SQL)
WilliamDAssafMSFT
wiassaf
07/26/2017
sql
t-sql
reference
REMOTE_PROC_TRANSACTIONS_TSQL
SET REMOTE_PROC_TRANSACTIONS
REMOTE_PROC_TRANSACTIONS
SET_REMOTE_PROC_TRANSACTIONS_TSQL
remote stored procedures [SQL Server]
SET REMOTE_PROC_TRANSACTIONS statement
distributed transactions [SQL Server], starting
REMOTE_PROC_TRANSACTIONS option
active transactions
TSQL

SET REMOTE_PROC_TRANSACTIONS (Transact-SQL)

[!INCLUDE SQL Server]

Specifies that when a local transaction is active, executing a remote stored procedure starts a [!INCLUDEtsql] distributed transaction managed by [!INCLUDEmsCoName] Distributed Transaction Coordinator (MS DTC).

Important

[!INCLUDEssNoteDepFutureAvoid] This option is provided for backward compatibility for applications that use remote stored procedures. Instead of issuing remote stored procedure calls, use distributed queries that reference linked servers. These are defined by using sp_addlinkedserver.

:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: Transact-SQL syntax conventions

Syntax

  
SET REMOTE_PROC_TRANSACTIONS { ON | OFF }   

Arguments

ON | OFF
When ON, a [!INCLUDEtsql] distributed transaction is started when a remote stored procedure is executed from a local transaction. When OFF, calling remote stored procedures from a local transaction does not start a [!INCLUDEtsql] distributed transaction.

Remarks

When REMOTE_PROC_TRANSACTIONS is ON, calling a remote stored procedure starts a distributed transaction and enlists the transaction with MS DTC. The instance of [!INCLUDEssNoVersion] making the remote stored procedure call is the transaction originator and controls the completion of the transaction. When a subsequent COMMIT TRANSACTION or ROLLBACK TRANSACTION statement is issued for the connection, the controlling instance requests that MS DTC manage the completion of the distributed transaction across the computers involved.

After a [!INCLUDEtsql] distributed transaction has been started, remote stored procedure calls can be made to other instances of [!INCLUDEssNoVersion] that have been defined as remote servers. The remote servers are all enlisted in the [!INCLUDEtsql] distributed transaction, and MS DTC ensures that the transaction is completed against each remote server.

REMOTE_PROC_TRANSACTIONS is a connection-level setting that can be used to override the instance-level sp_configure remote proc trans option.

When REMOTE_PROC_TRANSACTIONS is OFF, remote stored procedure calls are not made part of a local transaction. The modifications made by the remote stored procedure are committed or rolled back at the time the stored procedure completes. Subsequent COMMIT TRANSACTION or ROLLBACK TRANSACTION statements issued by the connection that called the remote stored procedure have no effect on the processing done by the procedure.

The REMOTE_PROC_TRANSACTIONS option is a compatibility option that affects only remote stored procedure calls made to instances of [!INCLUDEssNoVersion] defined as remote servers using sp_addserver. The option does not apply to distributed queries that execute a stored procedure on an instance defined as a linked server using sp_addlinkedserver.

The setting of SET REMOTE_PROC_TRANSACTIONS is set at execute or run time and not at parse time.

Permissions

Requires membership in the public role.

See Also

BEGIN DISTRIBUTED TRANSACTION (Transact-SQL)
SET Statements (Transact-SQL)