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

Troubleshooting Guide: SQL Server Error 6910 — Invalid XML Schema Collection Definition (Union Type Restriction)

Why This Error Happens

This error occurs when a developer attempts to register or modify an XML Schema Collection (XSD) in SQL Server 2025 that contains a <xs:restriction> applied to a <xs:union> simple type. SQL Server’s XML schema validation engine explicitly does not support deriving restrictions from union types, as this falls outside the subset of the W3C XML Schema specification implemented by the Database Engine. The root cause is almost always a structurally non-compliant XSD file being passed to a CREATE XML SCHEMA COLLECTION or ALTER XML SCHEMA COLLECTION statement, often one imported from an external system or generated by a third-party schema design tool that does not account for SQL Server’s limited schema support.

Step-by-Step Resolution Guide

Step 1: Identify the Offending Schema Collection and Type

  • Run the following query to locate the schema collection name and owning schema referenced in the error:
  • SELECT name, xml_collection_id FROM sys.xml_schema_collections WHERE name = '<CollectionName>';
  • Extract the full XSD definition using SELECT xml_schema_namespace(N'dbo', N'<CollectionName>'); to inspect the raw markup.
  • Search the extracted XML for the specific %ls type name reported in Error 6910 — this pinpoints the exact complexType or simpleType causing the failure.

Step 2: Locate and Remove the Union-Based Restriction

  • Open the XSD file in a text editor (VS Code, Notepad++) or XML IDE on your Windows Server 2025 / Windows 11 machine.
  • Search for the pattern <xs:union memberTypes= combined with a sibling or parent <xs:restriction base= referencing that same union type.
  • Refactor the schema: instead of restricting a union type, redefine the type as a direct <xs:simpleType> with explicit <xs:enumeration> or <xs:pattern> facets against a single base type (e.g., xs:string or xs:integer).
  • Save the corrected file to a known path, for example: C:\SQLSchemas\CorrectedSchema.xsd.

Step 3: Re-import the Corrected Schema Collection

  • Drop the invalid collection if it was partially created: DROP XML SCHEMA COLLECTION dbo.<CollectionName>;
  • Re-create it using the corrected file via sqlcmd or SSMS:
  • CREATE XML SCHEMA COLLECTION dbo.<CollectionName> AS N'<paste corrected XSD content here>';
  • Alternatively, load from disk using PowerShell/sqlcmd variable substitution: sqlcmd -S <ServerName> -d <DatabaseName> -Q "CREATE XML SCHEMA COLLECTION dbo.<CollectionName> AS N'$(Get-Content C:\SQLSchemas\CorrectedSchema.xsd -Raw)'"

Step 4: Validate Dependent Objects

  • Check any tables or stored procedures that reference the old schema collection using SELECT * FROM sys.columns WHERE xml_collection_id = <ID>;
  • Rebind affected xml typed columns if the collection was dropped and recreated with a new xml_collection_id, using ALTER TABLE <TableName> ALTER COLUMN <ColumnName> XML (dbo.<CollectionName>);

Alternative or Verification Steps

  • Verify the fix by re-running the original CREATE/ALTER XML SCHEMA COLLECTION statement in a non-production database — if Error 6910 no longer appears and sys.xml_schema_collections shows the new entry, the schema is valid.
  • If refactoring the union restriction is not feasible, bypass SQL Server’s native XSD validation entirely by storing and validating the XML at the application layer (e.g., using .NET’s XmlSchemaSet or a Java XSD validator) and persist the data as untyped xml in SQL Server instead of binding it to a schema collection.