How to fix Error 7213 on Windows Server 2025 / Windows 11

Troubleshooting Guide: SQL Server Error 7213

Why This Error Happens

Error 7213 occurs when SQL Server attempts to execute a remote stored procedure call (RPC) against a linked server, but the parameters sent by the provider do not match what the remote server expects. This mismatch is typically caused by schema drift between the local definition of the remote procedure and its actual current definition on the target server, outdated OLE DB/ODBC drivers used by the linked server provider, or incorrect configuration of the “RPC” and “RPC Out” options on the linked server. It can also surface when parameter data types are implicitly converted in a way the remote provider cannot reconcile, especially after an upgrade to SQL Server 2025 or Windows Server 2025 where updated driver versions may handle parameter marshaling differently.

Step-by-Step Resolution Guide

Step 1: Verify Linked Server RPC Configuration

  • Open SQL Server Management Studio (SSMS) and navigate to Server Objects > Linked Servers.
  • Right-click the linked server, select Properties, and go to the Server Options page.
  • Confirm both RPC and RPC Out are set to True.
  • Alternatively, run the following T-SQL to check and fix via script:
EXEC sp_serveroption 'YourLinkedServerName', 'rpc', 'true';
EXEC sp_serveroption 'YourLinkedServerName', 'rpc out', 'true';

Step 2: Validate the Remote Stored Procedure Signature

  • Connect directly to the remote server and run sp_helptext or inspect the procedure definition to confirm the exact number, order, and data types of parameters.
EXEC sp_help 'dbo.YourStoredProcedureName';
  • Compare this output against the calling code on the local server to ensure no parameters were added, removed, or reordered after a recent deployment.
  • Update the calling script to match the current parameter signature exactly, including optional parameters with default values.

Step 3: Update or Reconfigure the OLE DB/ODBC Provider

  • Navigate to Linked Servers > Providers in SSMS and verify the provider (e.g., MSOLEDBSQL, SQLNCLI) is the latest version certified for Windows Server 2025.
  • On Windows Server 2025 / Windows 11, download and install the latest Microsoft OLE DB Driver for SQL Server from the official Microsoft Download Center.
  • Restart the SQL Server service after installation:
Restart-Service -Name 'MSSQLSERVER'
  • Re-test the linked server connection using sp_testlinkedserver.

Step 4: Check for Implicit Parameter Data Type Mismatches

  • Review the data types of all parameters passed in the calling query versus the remote procedure’s expected types (e.g., VARCHAR vs NVARCHAR, INT vs BIGINT).
  • Explicitly cast or convert parameters in the calling T-SQL to match exactly:
EXEC YourLinkedServer.YourDatabase.dbo.YourStoredProcedure @Param1 = CAST(@LocalParam1 AS INT);

Alternative or Verification Steps

  • Run the stored procedure call manually from SSMS against the linked server after applying fixes; confirm it completes without raising Error 7213.
  • If the issue persists, as a workaround, replace the four-part naming RPC call with OPENQUERY syntax, which bypasses the RPC parameter-passing mechanism entirely and executes the query as a pass-through string on the remote server.