Microsoft SQL Server 2025 — Error 2203: “%sOnly ‘http://www.w3.org/2001/XMLSchema#decimal?'”
Why This Error Happens
This error occurs when SQL Server 2025 attempts to parse or validate an XML Schema Definition (XSD) and encounters a malformed or unsupported data type reference instead of a proper decimal declaration. It typically stems from corrupted XML schema collections stored in the database, a damaged system catalog entry, or an incompatible XML payload generated by a client application that does not conform to the W3C XMLSchema specification. In some cases, this is triggered by a failed or interrupted schema collection update, leaving a partial reference in sys.xml_schema_collections.
Step-by-Step Resolution Guide
Step 1: Validate the XML Schema Collection
- Run
SELECT name, xml_collection_id FROM sys.xml_schema_collections;to identify the affected schema. - Check for truncated or null entries in the
xml_schema_namespacedefinition usingSELECT xml_schema_namespace('schema_name', 'collection_name');. - Confirm the decimal data type is explicitly declared (e.g.,
<xs:element name="value" type="xs:decimal"/>) rather than left ambiguous or self-referencing.
Step 2: Rebuild the Corrupted XML Schema Collection
- Drop the broken collection safely using
DROP XML SCHEMA COLLECTION [SchemaName];(ensure no active dependencies first viasp_depends). - Re-import a clean, validated XSD file using
CREATE XML SCHEMA COLLECTION [SchemaName] AS N'<xsd file content>';. - Store the corrected
.xsdfile in a trusted path, such asC:\SQLServer\Schemas\, for version control and re-import if needed.
Step 3: Update SQL Server 2025 and Verify Compatibility
- Open PowerShell as Administrator and run
Get-HotFix | Where-Object {$_.Description -like "*SQL Server*"}to confirm the latest Cumulative Update is installed. - Apply the latest SQL Server 2025 CU from the Microsoft Update Catalog if missing, as early builds have known XML parser regressions affecting
xs:decimalresolution. - Restart the SQL Server service via
Restart-Service -Name 'MSSQLSERVER'after patching.
Step 4: Reset and Test the Client Connection Layer
- On Windows Server 2025 / Windows 11, verify the client’s XML serialization library (e.g., .NET
System.Xml.Schema) matches the W3C 2001 XMLSchema namespace version expected by SQL Server. - Clear any cached connection strings or stale XML payloads in the application layer, then re-test the data submission to SQL Server.
Alternative or Verification Steps
- Re-run the original query or stored procedure that triggered Error 2203 and confirm no exception is thrown; check
sys.messagesfor Error 2203 recurrence. - If the error persists, isolate the issue by testing the XSD independently in a tool like XML Notepad or Visual Studio’s XML Schema Explorer to confirm it’s W3C-compliant before reintroducing it to SQL Server.