Hot to Determine SQL Server version from a Backup File
⚠️NOTE: This procedure will only work when testing a SQL Server less than (or equal to) the one you are using.
restore headeronly from disk = N'C:\temp\db.bak'
Here is a list of SQL Server versions and their compatibility levels from SQL Server 2008 to version SQL Server 2017.
| SQL Server Version | Internal Database Version | Database Compatibility Level |
|---|---|---|
| SQL Server 2022 | 957 | 160 |
| SQL Server 2019 | 904 | 150 |
| SQL Server 2017 | 869 | 140 |
| SQL Server 2016 | 852 | 130 |
| SQL Server 2014 | 782 | 120 |
| SQL Server 2012 | 706 | 110 |
| SQL Server 2008 R2 | 660/661 | 100 |
| SQL Server 2008 | 655 | 100 |
You can compare the column DatabaseVersion from the result set with Internal Database version to determine the version of the database.
Revised: 2018-12-21
Copied!