Troubleshooting Guide: SQL Server Error 6927 – XML Validation: Invalid Simple Type Value
Why This Error Happens
Error 6927 occurs when SQL Server 2025 attempts to validate an XML instance against an XML Schema Collection (XSD), but a node’s value does not conform to the simple type defined in the schema (e.g., a string value placed where an xs:integer, xs:date, or xs:boolean is expected). This typically happens due to malformed data being inserted into a typed XML column, locale/culture mismatches in date or numeric formatting, or a corrupted/outdated XML Schema Collection that no longer matches the application’s data contract. It can also surface after an in-place upgrade to SQL Server 2025 if stricter XSD compliance checks were introduced for existing schema collections.
Step-by-Step Resolution Guide
Step 1: Identify the Offending XML Data and Schema
- Run the failing
INSERT/UPDATEstatement in isolation using SQL Server Management Studio (SSMS) connected to your SQL Server 2025 instance to capture the exact%lsvalue reported in the error message. - Query the schema collection in use with:
SELECT xml_schema_namespace(N'dbo', N'YourSchemaCollectionName'); - Cross-reference the failing value against the
<xs:simpleType>or<xs:restriction>definitions (base type, pattern, enumeration) in the retrieved XSD output.
Step 2: Correct the Data Format or Type Mismatch
- Adjust the source application or ETL process to format values according to the XSD-defined type (e.g., ensure dates are
YYYY-MM-DDforxs:date, booleans are lowercasetrue/false, not1/0orTrue). - For numeric types, verify no thousands separators or currency symbols are present in the XML payload.
- Re-test the insert using a minimal XML sample in SSMS:
DECLARE @x XML(YourSchemaCollection) = '<Root><Value>123</Value></Root>';
Step 3: Repair or Update the XML Schema Collection
- If the schema itself is outdated or too strict, drop and recreate it using
DROP XML SCHEMA COLLECTION YourSchemaCollectionName;followed byCREATE XML SCHEMA COLLECTIONwith the corrected XSD definition. - Store the updated XSD file in a version-controlled location (e.g.,
C:\SQLSchemas\YourApp\schema_v2.xsdon the Windows Server 2025 host) for change tracking. - Ensure the SQL Server service account has read access to any referenced external XSD import paths if schemas use
xs:importorxs:include.
Step 4: Apply Latest SQL Server 2025 Cumulative Update
- Open Windows Update or check the SQL Server Installation Center on Windows Server 2025 / Windows 11 for pending Cumulative Updates (CUs), as XML validation engine fixes are periodically released.
- Verify current build version with:
SELECT @@VERSION;and compare against Microsoft’s latest CU release notes for SQL Server 2025. - Restart the SQL Server service (
services.msc→ SQL Server (MSSQLSERVER) → Restart) after applying any update.
Alternative or Verification Steps
- Verify the fix by re-running the original failing transaction and confirming no Error 6927 appears in the SQL Server Error Log (
Get-Content "C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Log\ERRORLOG" -Tail 50in PowerShell). - As an alternative, if strict validation is not business-critical, temporarily store the data as untyped
XML(without a schema collection binding) and apply validation at the application layer instead.