Troubleshooting Guide: SQL Server Error 3245 – “Could Not Convert a String to or from Unicode”
Why This Error Happens
Error 3245 typically occurs during database backup or restore operations when SQL Server encounters a corrupted media header or an incompatible code page while attempting to translate string data between Unicode and non-Unicode formats. This is often caused by a damaged backup file, an incomplete file transfer (especially across different OS locales), or a mismatch between the collation settings of the source and destination servers. In some cases, the backup media itself may have been truncated or corrupted during storage or network transfer.
Step-by-Step Resolution Guide
Step 1: Verify Backup File Integrity
- Check the backup file size against the expected size from the source server to rule out truncation.
- Run
RESTORE VERIFYONLY FROM DISK = 'C:\Backups\YourFile.bak'in SQL Server Management Studio (SSMS) to test if the header is readable. - If the command fails immediately, the file is likely corrupted and will need to be re-generated from the source.
Step 2: Check Server and Database Collation Settings
- Open SSMS and run
SELECT SERVERPROPERTY('Collation');on both the source and destination instances. - Ensure both Windows Server 2025 instances are using compatible Unicode collations (e.g.,
SQL_Latin1_General_CP1_CI_AS). - If a mismatch exists, use the
COLLATEclause in your query or rebuild the database with the matching collation before restoring.
Step 3: Re-transfer the Backup Using Binary Mode
- If the file was moved via FTP or a network share, ensure the transfer protocol used Binary mode rather than ASCII mode, as ASCII mode corrupts Unicode byte structures.
- Navigate to the file location (e.g.,
D:\MSSQL\Backup\) and verify permissions allow the SQL Server service account full read/write access. - Re-copy the file using Robocopy with the
/J(unbuffered I/O) flag to prevent Windows Server 2025 caching issues:robocopy C:\Source D:\Destination YourFile.bak /J.
Step 4: Update SQL Server 2025 Cumulative Updates
- Navigate to the Microsoft Update Catalog and check if a specific Cumulative Update (CU) addresses Unicode conversion bugs for your build.
- Apply the update via the SQL Server Installation Center, selecting Maintenance > Edition Upgrade/Patch.
- Restart the SQL Server (MSSQLSERVER) service via
services.mscafter installation completes.
Alternative or Verification Steps
- Verification: Attempt the
RESTORE DATABASEcommand again after applying the fixes; success is confirmed if the database mounts and appears “Online” in SSMS Object Explorer without rollback errors. - Alternative: If the error persists, attempt to restore the backup on a different intermediary server with a default
SQL_Latin1_General_CP1_CI_AScollation to isolate whether the issue is collation-specific or purely file corruption.