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

Troubleshooting Guide: SQL Server Error 4004 – Unicode Data Cannot Be Sent to Legacy Clients

Why This Error Happens

This error occurs because the client application is connecting to SQL Server 2025 using an outdated communication protocol, specifically DB-Library (DB-Lib) or ODBC driver versions 3.7 or earlier, neither of which support the transmission of Unicode (nchar, nvarchar, ntext) data types. Since SQL Server 2025 relies heavily on Unicode-only collations for internationalization, the legacy driver stack lacks the necessary API calls to decode the UCS-2/UTF-16 stream being sent by the server. Essentially, the client driver is too old to understand the modern data format required by the server instance.

Step-by-Step Resolution Guide

Step 1: Identify the Outdated Driver Component

  • Check the specific client tool generating the error (e.g., ISQL, older OLE DB applications, or legacy ODBC connections).
  • Navigate to Control Panel > Administrative Tools > ODBC Data Sources (64-bit) to check the version number of the currently configured DSN (Data Source Name).
  • Look for drivers named “SQL Server” (the legacy driver) rather than “ODBC Driver 17/18 for SQL Server.”

Step 2: Install the Modern Microsoft ODBC Driver

  • Download and install the Microsoft ODBC Driver 18 for SQL Server from the official Microsoft Download Center.
  • Run the installer on the Windows Server 2025 / Windows 11 machine with Administrator privileges.
  • Verify installation path integrity at C:\Windows\System32\msodbcsql18.dll.

Step 3: Reconfigure the Data Source Name (DSN)

  • Open the ODBC Data Source Administrator tool again.
  • Select the problematic DSN and click Configure.
  • Change the “Driver” dropdown from the legacy SQL Server driver to ODBC Driver 18 for SQL Server.
  • Re-enter the Server name and Authentication credentials to refresh the connection string.

Step 4: Update the Connection String in Application Code

  • If the error stems from a custom application rather than a GUI tool, locate the web.config or app.config file.
  • Update the Provider or Driver keyword in the connection string from {SQL Server} to {ODBC Driver 18 for SQL Server}.
  • Save the file and recycle the Application Pool (IIS) or restart the service to apply changes.

Step 5: Adjust Database Collation (If Driver Update is Not Feasible)

  • If legacy hardware restricts driver updates, open SQL Server Management Studio (SSMS).
  • Run a script to alter the specific column collation from a Unicode-only type (like Latin1_General_100_CI_AS_SC) to a standard Windows collation that supports non-Unicode clients.
  • Note: This is a workaround and may affect character support for special symbols.

Alternative or Verification Steps

  • Verification: Re-run the specific query or stored procedure that triggered Error 4004 via the updated connection; the data should now render correctly in the client’s grid/text view instead of throwing a conversion error.
  • Alternative: If updating ODBC is not possible, use the SQL Server Native Client (SNAC) or switch the client application to use ADO.NET, which fully supports Unicode data types natively.