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

Troubleshooting Guide: Error 2361 – XSD Extension/Restriction Base Type Must Be Simple Type

Why This Error Happens

This error occurs when SQL Server 2025’s XML Schema Collection parser encounters an XSD definition where a complexType is used as the base type for an xs:extension or xs:restriction element, which violates XML Schema specification rules. This typically happens due to a malformed or hand-edited XSD file, a corrupted schema collection registered in the database, or a third-party export tool generating non-compliant XSD structures. Additionally, on Windows Server 2025/Windows 11 environments, outdated SQLXML provider components or mismatched .NET Framework XML libraries can cause valid schemas to be misinterpreted during validation.

Step-by-Step Resolution Guide

Step 1: Validate the XSD File Structure Independently

  • Open the offending .xsd file in Visual Studio 2022+ or an XML validator tool (e.g., xmllint) outside of SQL Server.
  • Locate the <xs:extension base="..."> or <xs:restriction base="..."> tag and confirm the referenced base attribute points to a simpleType, not a complexType.
  • Run xmllint --schema base.xsd target.xsd --noout from PowerShell to isolate the exact line number causing the conflict.

Step 2: Correct the Base Type Definition

  • If the base type is incorrectly defined as <xs:complexType name="BaseType">, change the extension to use <xs:complexContent> wrapping instead of a direct simple extension.
  • For simple value inheritance, ensure the base type is defined strictly as <xs:simpleType name="BaseType"> with a valid <xs:restriction base="xs:string"> (or appropriate primitive type) inside it.
  • Save the corrected file and re-import it into your project directory (e.g., C:\SQLServer\Schemas\).

Step 3: Drop and Re-register the Schema Collection in SQL Server

  • Connect to the instance via SQL Server Management Studio (SSMS) 21.
  • Execute DROP XML SCHEMA COLLECTION [dbo].[YourSchemaName]; to remove the cached corrupted version.
  • Re-create it using the corrected file:
  CREATE XML SCHEMA COLLECTION [dbo].[YourSchemaName] 
  AS N'C:\SQLServer\Schemas\corrected_schema.xsd';
  • Restart the SQL Server (MSSQLSERVER) service via services.msc to clear any cached schema validation metadata.

Step 4: Update SQL Server Native Client Components

  • Navigate to Control Panel > Programs and Features on the Windows Server 2025 host.
  • Verify that the Microsoft OLE DB Driver for SQL Server and SQLXML 6.0 components are updated to the latest build compatible with SQL Server 2025.
  • If missing, download and install the latest redistributable from the official Microsoft Download Center to ensure XSD parsing libraries are current.

Alternative or Verification Steps

  • To verify the fix, run a test INSERT or CAST operation against a column bound to the schema collection; if Error 2361 does not resurface, the schema is valid.
  • If the error persists after correction, bypass the native validator temporarily by setting the column to untyped XML (without schema binding) to confirm the data payload itself is valid before re-binding the collection.