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

Why This Error Happens

Error 2393 occurs when SQL Server attempts to parse an XML Schema Collection (XSD) that contains a malformed <xs:list> element. Per the W3C XML Schema specification, any list simple type definition must declare its item type using either the itemType attribute or by nesting a simpleType child element directly inside the list tag. When neither is present—often due to a corrupted import file, a manual editing mistake, or an incomplete schema export from a third-party ORM/ETL tool—the SQL Server XML parser rejects the registration of the schema collection entirely.

Step-by-Step Resolution Guide

Step 1: Locate the Offending XSD File or Script

  • Identify the exact CREATE XML SCHEMA COLLECTION or ALTER XML SCHEMA COLLECTION statement referenced in the error’s Location: '%ls' placeholder.
  • Open the source .xsd file (commonly found under C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Schemas\ or wherever your deployment scripts store them) in a text editor like VS Code.
  • Search for all instances of <xs:list to narrow down the problematic node.

Step 2: Correct the Malformed list Definition

  • Add a valid itemType attribute pointing to an existing simple type, for example: <xs:list itemType="xs:integer"/>.
  • Alternatively, nest a simpleType child directly, for example:
<xs:list>
  <xs:simpleType>
    <xs:restriction base="xs:string"/>
  </xs:simpleType>
</xs:list>
  • Save the corrected file using UTF-8 encoding to avoid introducing hidden BOM characters that can trigger secondary parsing errors.

Step 3: Re-Import the Schema Collection

  • Drop the existing broken collection if it partially registered: DROP XML SCHEMA COLLECTION dbo.YourSchemaName;
  • Re-run the corrected CREATE XML SCHEMA COLLECTION dbo.YourSchemaName AS '<xsd content>'; statement via SQL Server Management Studio (SSMS) or sqlcmd.
  • Confirm no other <xs:list>, <xs:union>, or nested complex type elements in the same file reference the broken type definition.

Step 4: Validate Server and OS-Level XML Parser Dependencies

  • On Windows Server 2025 / Windows 11, ensure the MSXML6 component is not corrupted by running sfc /scannow from an elevated Command Prompt.
  • Restart the SQL Server (MSSQLSERVER) service via services.msc to clear any cached schema parsing state.

Alternative or Verification Steps

  • Run SELECT * FROM sys.xml_schema_collections WHERE name = 'YourSchemaName'; to confirm the schema registered successfully without errors.
  • If the error persists, validate the XSD independently using an external tool (e.g., xmllint --schema or Visual Studio’s XML Schema Explorer) before attempting to re-import it into SQL Server, as this isolates whether the issue is SQL Server-specific or a genuinely invalid XSD file.