A database created by a more recent version of Microsoft SQL Server cannot be attached or restored to an earlier version. This restriction is there because an older version cannot know about file format changes that were introduced in the newer release.
If you attempt to attach a database to an earlier version, you will get SQL Server error 948
with the internal version numbers listed in the error message text:
-- Attaching SQL2019 database to SQL2017 CREATE DATABASE Database2019 ON (FILENAME = N'C:\SqlServerData\Database2019.mdf'), (FILENAME = N'C:\SqlServerData\Database2019_log.ldf') FOR ATTACH;
Msg 1813, Level 16, State 2, Line 1 Could not open new database 'Database2019'. CREATE DATABASE is aborted. Msg 948, Level 20, State 1, Line 1 The database 'Database2019' cannot be opened because it is version 904. This server supports version 869 and earlier. A downgrade path is not supported.
The internal database versions for SQL Server aren't clearly documented in the Microsoft documentation. To get the internal database version, you can use one of the following:
SELECT DATABASEPROPERTYEX(N'YourDatabaseName', 'Version');
-- Column DatabaseVersion RESTORE HEADERONLY FROM DISK = N'C:\backups\Database.bak';
-- Column status: search "Version=" EXEC sp_helpdb;
SQL Server Version | Internal Database Version | Database Compatibility Level | Supported Database Compatibility Levels |
---|---|---|---|
SQL Server 2022 | ? | 160 | ? |
SQL Server 2019 CTP 3.2 / RC 1 / RC 1.1 / RTM | 904 | 150 | 150,140,130,120,110,100 |
SQL Server 2019 CTP 3.0 / 3.1 | 902 | 150 | 150,140,130,120,110,100 |
SQL Server 2019 CTP 2.3 / 2.4 / 2.5 | 897 | 150 | 150,140,130,120,110,100 |
SQL Server 2019 CTP 2.1 / 2.2 | 896 | 150 | 150,140,130,120,110,100 |
SQL Server 2019 CTP 2.0 | 895 | 150 | 150,140,130,120,110,100 |
SQL Server 2017 | 868 / 869 | 140 | 140,130,120,110,100 |
SQL Server 2016 | 852 | 130 | 130,120,110,100 |
SQL Server 2014 | 782 | 120 | 120,110,100 |
SQL Server 2012 | 706 | 110 | 110,100,90 |
SQL Server 2012 CTP1 (a.k.a. SQL Server 2011 Denali) | 684 | 110 | 110,100,90 |
SQL Server 2008 R2 | 660 / 661 | 100 | 100,90,80 |
SQL Server 2008 | 655 | 100 | 100,90,80 |
SQL Server 2005 SP2+ with VarDecimal enabled | 612 | 90 | 90,80,70 |
SQL Server 2005 | 611 | 90 | 90,80,70 |
SQL Server 2000 | 539 | 80 | 80,70 |
SQL Server 7.0 | 515 | 70 | 70 |
SQL Server 6.5 | 408 | 65 | 65 |
SQL Server 6.0 | 406 | 60 | 60 |
Legend: ? = still investigating, RTM = Release to manufacturing, SPn = Service Pack n, CTP = Community Technology Preview (beta release).
You can comment here. If you know of a internal DB version that we don't have listed here, please use the comments.
I work on this site continuously and keep the information up to date. If it helps you, you can support me:
FONT: https://sqlserverbuilds.blogspot.com/2014/01/sql-server-internal-database-versions.html
Comments
Post a Comment