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

Troubleshooting Guide: SQL Server Error 8035 (TDS RPC Protocol Stream Incorrect)

Why This Error Happens

Error 8035 occurs when the client application sends a malformed table-valued parameter (TVP) to SQL Server, where the column structure defined in the TDS stream does not match the structure expected by the stored procedure or the target table type. This is typically caused by a mismatch in column count, data type, ordinal order, or nullability settings between the client-side DataTable/SqlDataRecord object and the server-side user-defined table type (UDTT). It can also result from outdated client drivers (ODBC/OLE DB/ADO.NET) that incorrectly serialize TVP metadata when communicating with SQL Server 2025.

Step-by-Step Resolution Guide

Step 1: Verify the User-Defined Table Type Schema

  • Open SQL Server Management Studio (SSMS) and connect to the SQL Server 2025 instance.
  • Run the following query to inspect the exact structure of the table type: SELECT c.name, c.column_id, t.name as type_name, c.max_length, c.is_nullable FROM sys.columns c JOIN sys.types t ON c.user_type_id = t.user_type_id WHERE c.object_id = TYPE_ID('YourSchema.YourTableType');
  • Compare the column order and data types against the client-side code (e.g., C# DataTable definition) to ensure they match exactly in sequence.

Step 2: Update Client Drivers and Connection Libraries

  • Navigate to the application server (Windows Server 2025 or Windows 11 machine) and check installed driver versions via Control Panel > Programs and Features.
  • Update the Microsoft OLE DB Driver for SQL Server or Microsoft.Data.SqlClient NuGet package to the latest version compatible with SQL Server 2025.
  • Restart the application pool or service in IIS Manager (if using a web application) to ensure the updated driver DLLs are loaded into memory.

Step 3: Audit the Application Code for Ordinal Mismatches

  • Review the C# or application code where SqlParameter is defined with SqlDbType.Structured.
  • Ensure the TypeName property explicitly matches the schema-qualified name of the SQL table type (e.g., dbo.MyTableType).
  • Check that the code does not attempt to pass more columns than the SQL table type defines, or skip a NOT NULL column without providing a default value.

Step 4: Clear Cached Execution Plans

  • If the table type was recently altered but the error persists, the issue may be a stale execution plan.
  • Run DBCC FREEPROCCACHE; in a query window connected to the specific database experiencing the error.
  • Re-execute the stored procedure call from the application to force SQL Server to recompile and re-validate the TVP structure.

Alternative or Verification Steps

  • Verification: Use SQL Server Profiler or Extended Events to trace the RPC:Completed event and inspect the specific TVP being sent in the TDS stream to confirm the data now matches the server type.
  • Alternative: If the error persists after driver updates, bypass the TVP temporarily by serializing the data into a JSON string and using the native OPENJSON function within the stored procedure to parse the data instead.