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

Troubleshooting Guide: SQL Server Error 946 — Database Version Mismatch

Why This Error Happens

Error 946 occurs when SQL Server 2025 attempts to attach or open a database file (.mdf/.ldf) that was created or last used by a newer version of SQL Server than the instance currently running, or when the internal database version number is incompatible with the engine’s supported version range. This commonly happens after restoring a backup from a newer SQL Server build onto an older instance, attaching detached files across mismatched versions, or incomplete upgrade processes that left the database in a pre-upgrade state. The engine refuses to mount the database because it cannot guarantee metadata and storage format compatibility, which could otherwise lead to corruption.

Step-by-Step Resolution Guide

Step 1: Verify the SQL Server Build and Database Version

  • Open SQL Server Management Studio (SSMS) and run SELECT @@VERSION; to confirm the exact build number and edition of your instance.
  • Check the database’s internal version by reviewing SQL Server error logs for the specific version number referenced in Error 946 (e.g., “version 950”).
  • Cross-reference the version number against Microsoft’s official SQL Server internal database version chart to identify which SQL Server release created the file.

Step 2: Confirm Source and Target SQL Server Versions Match

  • Identify whether the database was backed up, detached, or copied from a newer instance (e.g., SQL Server 2025 CTP/RC build vs. your current RTM or older Cumulative Update).
  • If the database originated from a newer build, you must restore it onto an instance of equal or higher version — downgrading is not supported.
  • Navigate to Help > About in SSMS or run SELECT SERVERPROPERTY('ProductVersion'); to compare build numbers precisely.

Step 3: Apply the Latest Cumulative Update or Service Pack

  • Download and install the latest Cumulative Update (CU) for SQL Server 2025 from the Microsoft Update Catalog to ensure your instance matches or exceeds the source database version.
  • Run the installer as Administrator and select the correct instance during the update wizard.
  • Restart the SQL Server service via services.msc or net stop MSSQLSERVER && net start MSSQLSERVER after the update completes.

Step 4: Restore or Attach the Database on a Compatible Instance

  • If the version gap cannot be resolved via updates, provision a new SQL Server 2025 instance using the same or newer build as the source environment.
  • Use RESTORE DATABASE [YourDB] FROM DISK = 'C:\Backups\YourDB.bak' WITH MOVE 'YourDB_Data' TO 'C:\SQLData\YourDB.mdf', MOVE 'YourDB_Log' TO 'C:\SQLData\YourDB_log.ldf'; to properly restore onto the compatible instance.
  • For detached files, use sp_attach_db or the SSMS “Attach” GUI only after confirming version compatibility, pointing to the correct .mdf and .ldf file paths (e.g., C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\DATA\).

Step 5: Validate Database Compatibility Level Post-Upgrade

  • Once attached successfully, run SELECT name, compatibility_level FROM sys.databases WHERE name = 'YourDB'; to confirm the compatibility level matches SQL Server 2025 standards.
  • If needed, update it using ALTER DATABASE [YourDB] SET COMPATIBILITY_LEVEL = 170; to align with the current engine version.

Alternative or Verification Steps

  • Confirm the fix by running DBCC CHECKDB('YourDB') WITH NO_INFOMSGS; to ensure the database is fully accessible and free of corruption after the version alignment.
  • If upgrading the instance is not feasible, contact the database owner to request a backup generated specifically in a format compatible with your current SQL Server build, or use the Generate Scripts wizard to recreate schema and data on your existing version.