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

SQL Server Error 7893: Incompatible XML Attributes on Parameter Value Node

Why This Error Happens

This error occurs when SQL Server 2025 parses an XML-formatted parameter payload (commonly used in extended client protocols, BCP XML format files, or parameterized queries sent via XML-based RPC) and finds two mutually exclusive attributes defined on the same node. This typically happens when a custom or third-party client library generates malformed XML by including both a null attribute and a value-type attribute (such as inline binary encoding) simultaneously on a single parameter node. It can also result from corrupted or manually edited XML format files used in bulk-insert operations, or from a mismatch between the client-side driver version and the XML schema expected by SQL Server 2025.

Step-by-Step Resolution Guide

Step 1: Identify the Offending XML Source

  • Check the application or ETL job that triggered the error; cross-reference the parameter name reported in the error message (%.*ls).
  • If using BCP or bcp.exe with an XML format file, locate the .xml file referenced in the command (e.g., C:\SQLData\Formats\import.xml).
  • Open the file in a text editor and search for the specific <COLUMN> or <RECORD> node tied to the reported parameter.

Step 2: Remove Conflicting Attributes from the XML Node

  • Look for nodes where both xsi:nil="true" and a value or TYPE-specific attribute (like LOCAL_TYPE with inline data) appear together — these cannot coexist.
  • Edit the node so it contains only one: either the null indicator or the value attribute, never both.
  • Save the file in UTF-8 encoding without BOM corruption, as SQL Server 2025 is stricter about encoding validation than prior versions.

Step 3: Update Client Drivers and Libraries

  • Ensure you are using the latest ODBC Driver 18+ or Microsoft.Data.SqlClient (v6.0 or later) compatible with SQL Server 2025’s updated XML parameter schema.
  • On Windows Server 2025 / Windows 11, go to Settings > Apps > Installed Apps, search for “SQL Server Native Client” or “ODBC Driver,” and update via the official Microsoft Download Center.
  • Restart the application pool or service consuming the connection after the driver update.

Step 4: Regenerate the Format File or Payload

  • If the XML was auto-generated by an ORM or custom serializer, regenerate it using bcp.exe -x to produce a fresh, schema-compliant format file rather than hand-editing an old one.
  • Example command:
  bcp YourDatabase.dbo.YourTable format nul -c -x -f C:\SQLData\Formats\import_new.xml -S YourServer -T
  • Replace the old format file reference in your import job with this newly generated version.

Alternative or Verification Steps

  • Run the import or parameterized query again and confirm Error 7893 no longer appears in SQL Server Logs (SQL Server Management Studio > Management > SQL Server Logs) or Windows Event Viewer under Applications and Services Logs > MSSQLSERVER.
  • As an alternative, bypass XML-based parameter passing entirely by switching the operation to a native Table-Valued Parameter (TVP) via a stored procedure call, which avoids manual XML construction and eliminates this class of attribute conflict entirely.