info@techdevops.com | 437-991-3573 | Data Engineering Services
TechDevOps.com
Resources Tools
Experts in Microsoft SQL Server on Windows, Linux, Containers | Clusters, Always On, FCI | Migrations, Cloud, Performance



How to detect database version from a Hosting Provider backup file
by BF (Principal Consultant; Architecture; Engineering)
2015-08-01







A database created by a more recent version of Microsoft SQL Server cannot be restored or attached to an earlier version. This restore restriction exists because an older version cannot know about any possible file format changes that were introduced in the newer release. Returning a result set containing all the backup header information it a quick method to determine if a restore is possible.


Solution:


T-SQL:

RESTORE HEADERONLY
FROM DISK = N'C:\Downloads\DB_Backups\<BackupFileNameHere>'
WITH NOUNLOAD;
GO


Image 1: RESTORE HEADERONLY Output





Image 2: Database Version





Image 3: Compatability Level:
(seen in ALTER DATABASE Compatibility Level (Transact-SQL))





Backup type:
1 = Database
2 = Transaction log
4 = File
5 = Differential database
6 = Differential file
7 = Partial
8 = Differential partial


Compressed:
Whether the backup set is compressed using software-based compression:
0 = No
1 = Yes


BackupTypeDescription:
DATABASE
TRANSACTION LOG
FILE OR FILEGROUP
DATABASE DIFFERENTIAL
FILE DIFFERENTIAL PARTIAL
PARTIAL DIFFERENTIAL