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

Why This Error Happens

Error 2748 occurs when a parameterized query attempts to use an unsupported or incompatible data type—such as TEXT, NTEXT, IMAGE, CURSOR, or certain large object (LOB) types—as a substitution parameter in a prepared statement. SQL Server’s query processor cannot bind these legacy or non-scalar data types to parameter markers (? or @param) because the execution plan caching mechanism requires strongly-typed, deterministic parameters. This typically surfaces when applications built on older ODBC/OLE DB drivers or ORM frameworks pass deprecated types into sp_prepare or sp_executesql calls.

Step-by-Step Resolution Guide

Step 1: Identify the Offending Parameter and Data Type

  • Review the full error message to find the specific parameter number (%d) and data type (%ls) flagged.
  • Check the client application’s connection string or stored procedure definition for columns typed as TEXT, NTEXT, IMAGE, or SQL_VARIANT.
  • Run sp_help '<ProcedureName>' in SSMS to inspect parameter and column definitions tied to the failing call.

Step 2: Convert Legacy Data Types to Modern Equivalents

  • Replace TEXT with VARCHAR(MAX).
  • Replace NTEXT with NVARCHAR(MAX).
  • Replace IMAGE with VARBINARY(MAX).
  • Execute an ALTER TABLE statement, for example:
  ALTER TABLE dbo.YourTable ALTER COLUMN YourColumn VARCHAR(MAX);

Step 3: Update the Client Driver and Connection Configuration

  • On Windows Server 2025 / Windows 11, open ODBC Data Sources (64-bit) via Control Panel > Administrative Tools.
  • Ensure the connection uses the ODBC Driver 18 for SQL Server or later, not legacy SQL Native Client (SNAC) drivers.
  • In the application’s connection string, verify Encrypt=yes and driver version compatibility to avoid forcing legacy type negotiation.

Step 4: Rebuild and Recompile Stored Procedures

  • Run EXEC sp_recompile 'YourProcedureName'; to clear cached execution plans referencing old parameter types.
  • If using an ORM (Entity Framework, Hibernate, etc.), regenerate the data model/mapping files so parameter types align with the updated schema.

Step 5: Restart SQL Server Service to Clear Plan Cache

  • Open SQL Server Configuration Manager.
  • Restart the SQL Server (MSSQLSERVER) service to fully flush cached plans.
  • Alternatively, run DBCC FREEPROCCACHE; for a non-disruptive cache clear in production environments.

Alternative or Verification Steps

  • Re-run the original query or application transaction that triggered Error 2748 and confirm it executes without exception; check SQL Server Error Logs via EXEC sp_readerrorlog; to ensure the error no longer appears.
  • If the error persists, bypass parameterization temporarily by using literal values in the query (for testing only) to isolate whether the issue is driver-side or schema-side.