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

Troubleshooting Guide: Error 11528 – Metadata Discovery Not Supported

Why This Error Happens

Error 11528 occurs when SQL Server’s sp_describe_first_result_set or driver-level metadata discovery (used by sys.dmexecdescribefirstresult_set, ODBC/JDBC drivers, or client preparation calls) attempts to analyze a Transact-SQL statement that includes constructs the metadata engine cannot statically resolve. Common culprits include dynamic SQL executed via EXEC() or sp_executesql with variable table names, the use of temporary tables created conditionally, INSERT...EXEC combinations, or statements containing SELECT * against objects that don’t exist at compile time. Because SQL Server 2025 enforces stricter contract validation for metadata discovery (used heavily by Entity Framework, BCP, and modern ADO.NET clients), procedures written for older engines may suddenly trigger this error after an upgrade from SQL Server 2019/2022.

Step-by-Step Resolution Guide

Step 1: Identify the Offending Statement in the Procedure

  • Open the stored procedure referenced in the error message using SQL Server Management Studio (SSMS) 21 or Azure Data Studio.
  • Locate the exact line number/statement referenced in the %.*ls placeholder of the error text.
  • Check for dynamic SQL blocks, temp table creation inside conditional branches (IF/ELSE), or EXEC sp_executesql calls that reference objects not resolvable until runtime.

Step 2: Rewrite the Statement to Support Static Metadata Resolution

  • Replace ambiguous SELECT * with an explicit column list (e.g., SELECT OrderID, CustomerID, OrderDate FROM dbo.Orders).
  • If using dynamic SQL, add a WITH RESULT SETS clause to explicitly define the expected output schema:
  EXEC sp_executesql @SQL WITH RESULT SETS ((OrderID INT, CustomerName NVARCHAR(100)));
  • For temp tables, ensure they are created in the same scope as the SELECT or declared via a table variable with an explicit schema rather than conditionally branching before creation.

Step 3: Update Client Connection Settings to Bypass Strict Discovery (If Rewrite Isn’t Feasible)

  • Open the connection string used by your application (found in web.config, appsettings.json, or the DSN configuration under Control Panel > ODBC Data Sources on Windows Server 2025/Windows 11).
  • Add or modify the parameter TDS_SCHEMA_RELAXED=1 or set FMTONLY behavior fallback by disabling the “Strict Metadata” flag in the connection provider settings (available under the SQL Server Native Client 12.0 or Microsoft ODBC Driver 19/20 configuration).
  • Restart the application pool (IIS) or application service to apply the updated connection string.

Step 4: Apply the Latest SQL Server 2025 Cumulative Update

  • Navigate to Microsoft Update Catalog and download the latest CU for SQL Server 2025.
  • Run the installer as Administrator: SQLServer2025-KB-x64.exe /quiet /IAcceptSQLServerLicenseTerms.
  • Reboot the server if prompted, then verify the build number via SELECT @@VERSION; in SSMS.

Alternative or Verification Steps

  • Run EXEC sp_describe_first_result_set @tsql = N'EXEC dbo.YourProcedureName'; directly in SSMS to confirm the metadata can now be resolved without throwing Error 11528.
  • If the error persists, as a workaround, instruct the client application to use SET FMTONLY OFF behavior or switch to sys.sp_describe_undeclared_parameters for parameter-only discovery instead of full result-set discovery.