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

Why This Error Happens

This error occurs when SQL Server attempts to parse or generate XML output (typically via FOR XML clauses, SSIS packages, or XML data type operations) and encounters a character that violates XML entity reference rules—most commonly an ampersand (&) not followed by a valid entity name like & or <. It can also surface when corrupted XML configuration files (such as ReportServer.config or SSIS package .dtsx files) contain raw special characters that were never properly escaped during a save or export operation. Additionally, data migrated from legacy systems or bulk-inserted text fields often contain control characters (ASCII 0x00–0x1F) that are illegal in XML 1.0 and trigger this parser failure.

Step-by-Step Resolution Guide

Step 1: Identify the Offending Data or File

  • Run the failing query in SQL Server Management Studio (SSMS) against a smaller subset of rows using TOP 100 to isolate the exact record causing the failure.
  • Check for unescaped ampersands using: SELECT * FROM YourTable WHERE YourColumn LIKE '%&%' AND YourColumn NOT LIKE '%&%'
  • If the error originates from a config file, open it in a plain text editor (Notepad++) rather than an XML-aware editor to see raw, un-rendered characters.

Step 2: Sanitize and Escape Invalid Characters

  • Update the source data using REPLACE() to escape raw ampersands: UPDATE YourTable SET YourColumn = REPLACE(YourColumn, '&', '&') WHERE YourColumn LIKE '%&%' AND YourColumn NOT LIKE '%&%'
  • Strip illegal control characters using a cleanup function or PATINDEX to detect ASCII values below 0x20, excluding tab, carriage return, and line feed.
  • If the issue is in a config file located at C:\Program Files\Microsoft SQL Server\MSRS16.MSSQLSERVER\Reporting Services\ReportServer\rsreportserver.config, manually correct the invalid character and save as UTF-8 encoding.

Step 3: Validate XML Schema Compliance

  • For FOR XML queries, wrap suspect columns with (SELECT YourColumn FOR XML PATH('')) to force automatic entity encoding before combining into the final result set.
  • Ensure the application or ETL process (SSIS, Integration Services) is using System.Xml.XmlWriter rather than raw string concatenation when generating XML payloads.

Step 4: Restart Dependent Services

  • Open Services.msc on Windows Server 2025 and restart SQL Server (MSSQLSERVER) and SQL Server Reporting Services (SSRS) if config files were modified.
  • Clear any cached execution plans related to the query using DBCC FREEPROCCACHE to ensure the corrected data path is used.

Alternative or Verification Steps

  • Re-run the original FOR XML query or report generation job; confirm Error 2283 no longer appears in SQL Server Logs (viewable via EXEC xp_readerrorlog 0, 1, N'2283').
  • If the error persists, use SELECT YourColumn, ASCII(SUBSTRING(YourColumn, Number, 1)) FROM master..spt_values CROSS APPLY ... combined with a tally table to scan character-by-character for any remaining non-printable ASCII values below decimal 32.