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

Troubleshooting Guide: SQL Server Error 2201 – “Derivation from ‘anySimpleType’ by restriction is not permitted”

Why This Error Happens

This error occurs when SQL Server attempts to parse or validate an XML Schema Collection (XSD) that contains an invalid type derivation, specifically where a custom simple type tries to restrict the base anySimpleType directly, which XML Schema specifications explicitly disallow. This typically happens due to a malformed or corrupted XML schema being registered in the database, often introduced through a faulty third-party import script, a corrupted .xsd file, or an improperly upgraded schema collection carried over from a legacy SQL Server instance. It can also surface after an in-place upgrade to SQL Server 2025 on Windows Server 2025 if the XML parser engine enforces stricter W3C compliance than previous versions.

Step-by-Step Resolution Guide

Step 1: Identify the Offending XML Schema Collection

  • Open SQL Server Management Studio (SSMS) and connect to the affected instance.
  • Run the following query to locate custom XML schema collections in the database: SELECT name, xml_schema_namespace FROM sys.xml_schema_collections WHERE name != 'sys';
  • Cross-reference the schema collection with recent deployment scripts or import jobs to identify the source file.

Step 2: Validate and Repair the XSD File Externally

  • Export the schema collection content using SELECT xml_schema_namespace FROM sys.xml_schema_collections WHERE name = 'YourSchemaName'; and save the output as a .xsd file.
  • Open the file in a validator (such as Visual Studio 2022/2025 or an online W3C XSD validator) to pinpoint the exact line where a <xs:restriction base="xs:anySimpleType"> declaration exists.
  • Correct the schema by changing the restriction base to a valid derived type (e.g., xs:string, xs:token, or xs:anyAtomicType depending on context), since direct restriction of anySimpleType is against the W3C XML Schema spec.

Step 3: Drop and Recreate the Schema Collection

  • Drop the broken collection using: DROP XML SCHEMA COLLECTION YourSchemaName;
  • Re-import the corrected, validated .xsd file using: CREATE XML SCHEMA COLLECTION YourSchemaName AS '<corrected_schema_content>';
  • Restart the SQL Server service via services.msc or Restart-Service MSSQLSERVER in PowerShell (run as Administrator) to clear any cached parser states on Windows Server 2025.

Step 4: Check for Server-Level XML Parser Updates

  • Navigate to Windows Update settings (Settings > Windows Update) on the Windows Server 2025/Windows 11 host and ensure the latest Cumulative Update (CU) for SQL Server 2025 is applied, as early builds had known MSXML parser strictness bugs.
  • Verify the installed build number via: SELECT @@VERSION; and compare it against the latest CU release notes from Microsoft.

Alternative or Verification Steps

  • Verify the fix by re-running the original INSERT, UPDATE, or stored procedure call that triggered Error 2201; it should now execute without throwing the derivation exception.
  • If the error persists despite a valid schema, bypass strict XSD validation temporarily by casting the XML data as untyped (XML without schema binding) to confirm the schema collection itself is the root cause rather than the underlying data.