'How to deal with SQL server error: The database cannot be opened because it is version 904. This server supports version 852 and earlier [closed]

While connecting to SQL Server database by attaching to an MDF file, the following error is returned:

The database cannot be opened because it is version 904. This server supports version 852 and earlier. A downgrade path is not supported.

How to deal with that?



Solution 1:[1]

That file has been created with a SQL Server 2019 version (localdb or full).
The localdb installed on your machine supports SQL Server 2016 files.
Therefore you are not able to open that file.

You have two options:

  1. Upgrade your version of localdb to version 2019.
  2. Try to get a file produced with a version compatible with yours.

According to this article

https://sqlserverbuilds.blogspot.com/2014/01/sql-server-internal-database-versions.html

you can retrieve the internal database version using one of these commands

SELECT DATABASEPROPERTYEX(N'YourDatabaseName', 'Version');

-- Column DatabaseVersion
RESTORE HEADERONLY FROM DISK = N'C:\backups\Database.bak';

-- Column status: search "Version="
EXEC sp_helpdb;

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1