Troubleshooting Guide: SQL Server Error 6844
Why This Error Happens
Error 6844 occurs when SQL Server’s XML Schema Collection validator encounters two elements that share the same name but have conflicting type definitions, and these elements are not positioned as direct siblings within the same hierarchical level. This typically results from a malformed or inconsistent XSD schema being registered in a XML Schema Collection, often introduced during an application update, schema migration, or manual edit of the schema definition. Corrupted schema collection metadata after an in-place upgrade to SQL Server 2025 can also trigger this validation failure.
Step-by-Step Resolution Guide
Step 1: Identify the Offending XML Schema Collection
- Run the following query to locate schema collections in the affected database:
SELECT name, schema_id FROM sys.xml_schema_collections;- Cross-reference the element name reported in the error message (
%.*ls) against the schema definitions using: SELECT xml_schema_namespace(SCHEMA_NAME(schema_id), name) FROM sys.xml_schema_collections WHERE name = 'YourCollectionName';- Export the result to a
.xsdfile for manual inspection.
Step 2: Correct the XSD Structure
- Open the exported XSD in a validator (Visual Studio 2025 or an online XSD linter works well).
- Search for duplicate element names that exist at different nesting levels with mismatched
typeattributes. - Rename conflicting elements or consolidate them into a shared complex type if they are meant to represent the same structure.
- Ensure elements intended to share a type are declared as direct siblings inside the same
<xs:sequence>or<xs:choice>block.
Step 3: Drop and Recreate the Schema Collection
- Back up the database before making changes:
BACKUP DATABASE [YourDB] TO DISK = 'C:\Backups\YourDB_PreFix.bak';- Drop the broken collection (ensure no columns/tables currently reference it, or alter those first):
DROP XML SCHEMA COLLECTION YourSchemaCollectionName;- Recreate it using the corrected XSD:
CREATE XML SCHEMA COLLECTION YourSchemaCollectionName AS N'<corrected XSD content here>';
Step 4: Apply Latest Cumulative Update
- Open SQL Server Setup or Windows Update on Windows Server 2025 / Windows 11 and check for SQL Server 2025 Cumulative Updates.
- Install the latest CU, as early builds of SQL Server 2025 had a known XML validation engine bug affecting nested schema collections.
- Restart the SQL Server (MSSQLSERVER) service via
services.mscafter the update completes.
Alternative or Verification Steps
- After recreating the schema collection, re-run any INSERT/UPDATE statements that previously failed with Error 6844 to confirm the validation now passes.
- If the error persists, use
sqlcmd -S localhost -Q "DBCC CHECKDB('YourDB') WITH NO_INFOMSGS"to rule out underlying database corruption affecting system catalog views related to XML schemas.