Troubleshooting Guide: SQL Server Error 2369
Why This Error Happens
Error 2369 occurs when SQL Server parses an XML Schema Collection (XSD) that contains a complexType definition with more than one structural model group—such as sequence, choice, all, or group—nested directly within a single restriction or extension element. The XML Schema specification strictly permits only one such compositor per restriction/extension block, so when SQL Server’s schema validation engine encounters a malformed or hand-edited XSD with duplicate compositors, it rejects the registration and throws this error. This typically happens after a schema collection is altered manually, imported from an external system, or generated by a third-party tool that does not strictly adhere to W3C XSD structural rules.
Step-by-Step Resolution Guide
Step 1: Identify the Offending XML Schema Collection
- Run the following query to locate the schema collection referenced in the error’s location path (
%ls): SELECT name, schema_namespace FROM sys.xml_schema_collections WHERE name = 'YourSchemaCollectionName';- Extract the full XSD definition using
SELECT xml_schema_namespace(N'SchemaName', N'CollectionName');to inspect its raw structure.
Step 2: Locate and Correct the Duplicate Compositor
- Open the extracted XSD in a text editor or Visual Studio XML editor on your Windows Server 2025 / Windows 11 machine.
- Search for
<xs:restriction>or<xs:extension>blocks containing more than one of:<xs:sequence>,<xs:choice>,<xs:all>, or<xs:group>. - Consolidate the content into a single compositor (commonly
<xs:sequence>) by merging child elements from the duplicate groups into one valid group. - Save the corrected file as a
.xsdfile, for example:C:\SQLSchemas\CorrectedSchema.xsd.
Step 3: Drop and Re-Register the Schema Collection
- Drop the broken collection (only if no dependent tables/columns reference it):
DROP XML SCHEMA COLLECTION YourSchemaCollectionName; - Re-create it using the corrected XSD file:
CREATE XML SCHEMA COLLECTION YourSchemaCollectionName AS 'contents_of_corrected_xsd_file';- If dependencies exist, use
ALTER XML SCHEMA COLLECTION YourSchemaCollectionName ADD 'corrected_fragment';instead to patch incrementally.
Step 4: Validate Application/ETL Source Files
- If the schema originates from an external application (e.g., BizTalk, a .NET XSD generator, or a third-party ETL tool), check the generator’s export settings under its configuration directory, typically found in
C:\Program Files\<VendorApp>\Config\. - Update or patch the generator so future exports do not produce duplicate compositors.
Alternative or Verification Steps
- Verify the fix by re-running the original
CREATE XML SCHEMA COLLECTIONorALTERstatement that previously failed — it should complete without raising Error 2369. - As an alternative, validate the XSD offline using the
xsd.exeutility (included with Visual Studio Build Tools) or an online XSD validator before importing it into SQL Server, catching compositor violations prior to deployment.