Why This Error Happens
Error 2360 occurs when SQL Server 2025 parses an XML Schema Definition (XSD) and encounters an element or attribute declaration that specifies both a name and a ref attribute simultaneously, which violates the W3C XML Schema specification. This typically happens when a custom XML Schema Collection is registered with malformed XSD syntax, or when a third-party tool generates XSD files for SSIS packages, XML columns, or SOAP endpoints with conflicting declarations. It can also surface after a failed in-place upgrade from SQL Server 2022 to 2025, where legacy schema collections were not revalidated against the stricter 2025 XML parser.
Step-by-Step Resolution Guide
Step 1: Identify the Offending Schema File
- Review the full error message for the
Location: '%ls'value — this points to the exact XSD file path or XML Schema Collection name causing the conflict. - Run the following query to locate schema collections in the affected database:
SELECT name, schema_namespace, xml_schema_namespace_id
FROM sys.xml_schema_collections;
- Export the suspect schema using
SELECT xml_schema_namespace('dbo','SchemaName')to inspect its raw XSD content.
Step 2: Correct the XSD Declaration
- Open the XSD file in a text editor or Visual Studio 2022/2025 XML editor.
- Locate the
<xs:element>or<xs:attribute>node that has bothname="..."andref="..."set. - Per XSD rules, keep only one: use
namewhen defining a new element locally, or userefwhen referencing an already-declared global element — remove the redundant attribute. - Save the corrected file with UTF-8 encoding (no BOM) to avoid secondary parsing errors.
Step 3: Re-register the XML Schema Collection
- Drop the broken collection if it partially registered:
DROP XML SCHEMA COLLECTION dbo.YourSchemaName;
- Re-create it using the corrected XSD file:
CREATE XML SCHEMA COLLECTION dbo.YourSchemaName AS N'<corrected XSD content>';
- If the error originated from an SSIS package or SSDT project, right-click the
.dtsx/.xsdreference in Solution Explorer and select Validate XML before redeploying.
Step 4: Clear Cached Metadata (Windows Server 2025 / Windows 11)
- Restart the SQL Server (MSSQLSERVER) service via
services.mscor:
Restart-Service -Name MSSQLSERVER -Force
- Clear the SSISDB cache if applicable by running
exec [SSISDB].[catalog].[clean_logs]to remove stale schema references tied to failed deployments.
Alternative or Verification Steps
- Verify the fix by re-running the query/import operation that triggered Error 2360; confirm
sys.xml_schema_collectionsnow shows the schema without errors usingSELECT * FROM sys.dm_exec_describe_xml_schema_collection(...). - If the issue persists, use the XSD Schema Validation Tool (
xsd.exefrom the Windows SDK) locally to lint the file independently of SQL Server — this isolates whether the error is in the SQL Server parser or the source XSD itself.