SET REMOTE_PROC_TRANSACTIONS (Transact-SQL)
Applies to:
SQL Server
Specifies that when a local transaction is active, executing a remote stored procedure starts a Transact-SQL distributed transaction managed by Microsoft Distributed Transaction Coordinator (MS DTC).
Important
This feature will be removed in a future version of SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature. 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.
Transact-SQL syntax conventions
Syntax
SET REMOTE_PROC_TRANSACTIONS { ON | OFF }
Note
To view Transact-SQL syntax for SQL Server 2014 (12.x) and earlier versions, see Previous versions documentation.
Arguments
ON | OFF
When ON, a Transact-SQL 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 Transact-SQL 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 SQL Server 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 Transact-SQL distributed transaction has been started, remote stored procedure calls can be made to other instances of SQL Server that have been defined as remote servers. The remote servers are all enlisted in the Transact-SQL 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 SQL Server 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)