SQL Server Error 950 means the database you are trying to attach or restore has a version number that is higher than the version supported by the SQL Server instance you are using. In plain terms, the database was created or upgraded on a newer SQL Server release, and the older instance cannot read it. The fix is to move the database to a SQL Server instance that is at least as new as the one that last upgraded it, or to use a supported downgrade path such as exporting the schema and data. You cannot force an older engine to open a newer database file.

What You'll Need

  • The .mdf and .ldf files of the database you are trying to attach, or a .bak backup file.
  • Access to a SQL Server instance that is the same version or newer than the one that last upgraded the database.
  • Sysadmin or dbcreator rights on the target SQL Server instance.
  • SQL Server Management Studio (SSMS) or Azure Data Studio installed on your workstation.
  • A maintenance window if the database is in production.

Step-by-Step

  1. Confirm the actual error text. Open SSMS, connect to the instance, and reproduce the failure. The full message usually reads: "Database cannot be upgraded because its non-release version (xxx) is not supported by this version of SQL Server." Note the version number in the message; that is the internal database version, not the SQL Server build number.
  2. Identify the SQL Server version that last touched the database. If you still have the original server, run SELECT @@VERSION; in a query window. If you only have the files, check the SQL Server error log or ask whoever created the backup. The database version must match or be lower than the target instance's supported version.
  3. Check the target instance version. Run SELECT SERVERPROPERTY('ProductVersion'), SERVERPROPERTY('ProductLevel'), SERVERPROPERTY('Edition'); on the instance where the attach or restore failed. Compare the major version number (for example 15.x for SQL Server 2019, 16.x for SQL Server 2022) with the source server.
  4. Choose the correct target instance. If the source is newer, install or locate a SQL Server instance of the same or newer major version. You cannot attach a newer database to an older engine, even with compatibility level changes; compatibility level affects query behaviour, not file format.
  5. Attach or restore on the correct instance. In SSMS, right-click Databases and choose Attach, then add the .mdf file. For a backup, right-click Databases and choose Restore Database, select the .bak file, and complete the wizard. If the restore fails with the same error, the backup was taken from a newer version.
  6. If you must move the database to an older instance, use a logical export. On the newer instance, right-click the database, choose Tasks > Generate Scripts, and script the schema and data. Alternatively, use the SQL Server Import and Export Wizard to copy tables to the older instance. This recreates objects and data rather than copying the file, so it works across versions.
  7. Verify the database is online and consistent. After attach or restore, run DBCC CHECKDB on the database and confirm the application connects. Check that the compatibility level is appropriate for the target engine.
  8. Update your process. Record the SQL Server version used for backups and attaches so future restores target a compatible instance. Keep development, staging, and production instances on the same major version where possible.

Common Mistakes

  • Trying to attach the .mdf file to an older SQL Server and expecting a compatibility-level change to fix it. Compatibility level does not change the file format.
  • Restoring a backup from a newer SQL Server to an older one. The backup contains the same internal version and will fail the same way.
  • Copying only the .mdf file without the matching .ldf file. Attaching without the log can leave the database in a suspect state; use the Attach dialog and add both files, or use sp_attach_single_file_db only when the log is genuinely missing and you accept the risk.
  • Assuming the error is a permissions problem. Error 950 is a version mismatch, not a login or file-access issue.
  • Ignoring the version number in the error message. It tells you exactly how new the database is relative to the engine.

Tips

  • Use SELECT name, compatibility_level FROM sys.databases; to see compatibility levels, but remember this is separate from the file version that triggers error 950.
  • When building a new server, install the same major version as your source systems to avoid restore surprises.
  • For migrations to an older environment, script objects and data rather than copying files. It is slower but reliable.
  • Keep a copy of the original .mdf and .ldf files before any attach attempt, in case a failed attach leaves them in a changed state.
  • Document the SQL Server build number alongside every backup so the restore target can be chosen correctly.

Troubleshooting

If the attach still fails after moving to a newer instance, check that you are connecting to the intended instance and not a named instance or localdb that happens to be older. In SSMS, the server name in the connection dialog shows which instance you are on. If the restore fails, verify the backup file was not taken from a newer version by checking the source server's @@VERSION. If you cannot access a newer instance, the only supported route is to export schema and data from a working copy of the database, which requires a server that can open it. If the database files are corrupted, restore from a known-good backup instead of attaching. If you see a suspect state after attach, run DBCC CHECKDB and review the SQL Server error log for details. Do not delete the original files until the new copy is verified.

Frequently Asked Questions

Can I downgrade a database to an older SQL Server version?

Not by attaching or restoring the files. You must script the schema and data or use the Import and Export Wizard to recreate the database on the older instance.

Does changing the compatibility level fix error 950?

No. Compatibility level affects query optimizer behaviour, not the physical file format that causes error 950.

What does the version number in the error mean?

It is the internal database version written by the SQL Server engine that last upgraded the database. A higher number than the target engine supports triggers the error.

Can I attach just the .mdf file without the .ldf?

It is possible in some cases using sp_attach_single_file_db, but it can leave the database in a suspect state and is not recommended when the log is available. Attach both files where possible.

Will a backup from a newer SQL Server restore to an older one?

No. The backup carries the same internal version, so the restore fails with the same error. Use a logical export instead.

How do I check which SQL Server version I have?

Run SELECT @@VERSION; in a query window, or check SERVERPROPERTY('ProductVersion') for the build number.