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 COLLECTIONorALTER XML SCHEMA COLLECTIONstatement referenced in the error’sLocation: '%ls'placeholder. - Open the source
.xsdfile (commonly found underC:\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:listto narrow down the problematic node.
Step 2: Correct the Malformed list Definition
- Add a valid
itemTypeattribute pointing to an existing simple type, for example:<xs:list itemType="xs:integer"/>. - Alternatively, nest a
simpleTypechild 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) orsqlcmd. - 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 /scannowfrom an elevated Command Prompt. - Restart the SQL Server (MSSQLSERVER) service via
services.mscto 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 --schemaor 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.