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

Troubleshooting Guide: SQL Server Error 6973 — Invalid Attribute Redefinition

Why This Error Happens

Error 6973 occurs when SQL Server 2025 processes an XML Schema Collection (XSD) where a derived complex type attempts to redefine an attribute that was marked as “required” in its base type, but the derived type declares it as optional or omits the “use” constraint entirely. This is a schema validation conflict enforced by the XML Schema Definition (XSD) engine within SQL Server’s XML data type infrastructure, not a server configuration fault. It typically surfaces after a schema collection is altered via ALTER XML SCHEMA COLLECTION or during an in-place upgrade where legacy schema collections (migrated from SQL Server 2019/2022) contain inheritance definitions that violate the stricter W3C XSD 1.1 compliance checks introduced in SQL Server 2025.

Step-by-Step Resolution Guide

Step 1: Identify the Offending Schema Collection

  • Run the following query to locate the schema collection referenced in the error and extract its XML definition:
SELECT name, xml_schema_namespace, SCHEMA_NAME(schema_id) AS owner_schema
FROM sys.xml_schema_collections
WHERE name = '<CollectionNameFromErrorLog>';
  • Export the full XSD using SELECT XML_SCHEMA_NAMESPACE('dbo','YourCollectionName') to inspect the <xs:complexType> and <xs:extension base="..."> blocks.

Step 2: Correct the Attribute “use” Declaration

  • Open the exported XSD in a text editor (Visual Studio Code or XML Notepad on Windows 11/Server 2025).
  • Locate the base type’s attribute definition, e.g., <xs:attribute name="OrderID" use="required"/>.
  • Ensure the derived type (via xs:extension or xs:restriction) also declares use="required" — do NOT set it to use="optional" or omit the use attribute, as omission defaults to optional and triggers the conflict.
  • Save the corrected XSD file to C:\SQLSchemas\Corrected\ (or equivalent path on your Windows Server 2025 instance).

Step 3: Drop and Recreate the Schema Collection

  • Since XML Schema Collections cannot be directly edited once a conflicting type exists, drop the broken collection (ensure no dependent columns/tables reference it first):
DROP XML SCHEMA COLLECTION dbo.YourCollectionName;
  • Recreate it using the corrected file:
CREATE XML SCHEMA COLLECTION dbo.YourCollectionName
AS N'C:\SQLSchemas\Corrected\schema_fixed.xsd';

Step 4: Apply SQL Server 2025 Cumulative Update

  • Check your build version with SELECT @@VERSION; and compare against the latest Cumulative Update (CU) listed in the Microsoft Update Catalog for SQL Server 2025.
  • If running RTM or an early CU, apply the latest patch via Windows Update or manually through Setup.exe /Action=Patch /AllInstances — this resolves a known XSD-inheritance validation bug in the initial release build.

Alternative or Verification Steps

  • Verify the fix by re-running the original ALTER/CREATE statement that triggered Error 6973; successful execution with no output confirms resolution.
  • If the error persists after schema correction, check SQL Server Error Log (C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Log\ERRORLOG) for a secondary Event ID pointing to a corrupted .xsd cache, and restart the SQL Server service to clear the in-memory schema compilation cache.