SA0211 : Setting REMOTE_PROC_TRANSACTIONS option is deprecated

Ensure compatibility with future SQL Server versions by avoiding deprecated features like REMOTE_PROC_TRANSACTIONS.

Description

When developing or maintaining T-SQL code for SQL Server, using deprecated features like REMOTE_PROC_TRANSACTIONS can lead to issues in future releases, as these features may be removed. The REMOTE_PROC_TRANSACTIONS option relates to remote stored procedure transactions and is supported for historical reasons. However, its reliance can limit forward compatibility.

For example:

SQL
1-- Deprecated practice with REMOTE_PROC_TRANSACTIONS
2SET REMOTE_PROC_TRANSACTIONS ON;
3-- Code that utilizes remote stored procedure calls
4EXEC RemoteServer.MyDatabase.MyRemoteProcedure;

This example illustrates the problem because the reliance on REMOTE_PROC_TRANSACTIONS means the code may no longer work when the feature is removed in future SQL Server versions. Instead, developers should use distributed queries and linked servers setup which offer a more robust and compatible approach.

  • Future SQL Server updates will likely remove the deprecated option, causing potential functionality and compatibility issues.

  • Using distributed queries with linked servers, defined by sp_addlinkedserver, provides a modern and efficient alternative.

How to fix

Modify your T-SQL code to avoid using deprecated features like REMOTE_PROC_TRANSACTIONS to ensure compatibility with future SQL Server releases.

Follow these steps to address the issue:

  1. Identify any instances in your code where REMOTE_PROC_TRANSACTIONS is set. This is typically done using SET REMOTE_PROC_TRANSACTIONS ON.

  2. Replace deprecated remote procedure transaction handling with distributed queries using linked servers. Set up linked servers using sp_addlinkedserver to connect and run remote procedures or queries.

  3. Update any code that executes remote stored procedures to utilize the linked server configuration. Use EXEC with linked server syntax for invoking remote procedures or SELECT queries that span multiple servers.

For example:

SQL
1-- Corrected approach using a linked server
2EXEC LinkedServer.MyDatabase.MyRemoteProcedure;

Scope

The rule has a Batch scope and is applied only on the SQL script.

Parameters

Rule has no parameters.

Remarks

The rule does not need Analysis Context or SQL Connection.

Effort To Fix
1 hour per issue.
Categories

Deprecated Features, Bugs

Additional Information
Example Test SQL
SQL
1SET REMOTE_PROC_TRANSACTIONS ON
2SET REMOTE_PROC_TRANSACTIONS OFF

Analysis Results
  Message Line Column
1 SA0211 : Setting REMOTE_PROC_TRANSACTIONS option is deprecated. 1 4
2 SA0211 : Setting REMOTE_PROC_TRANSACTIONS option is deprecated. 2 4
See Also

Other Resources