Friday, September 21, 2012

Identify SQL Server Database Backup Version

How to Identify SQL Server Database Backup Version.
Following is the query:
RESTORE HEADERONLY FROM DISK='C:DatabaseBackupsDatabaseBackup.bak'
Specify the correct path of the backup file.
When this query is executed read the values of the columns  

SoftwareVersionMajor,SoftwareVersionMinor and SoftwareVersionBuild.
The version of the SQL Server backup can be found by concatinating the values in three columns.
version of backup = SoftwareVersionMajor.SoftwareVersionMinor.SoftwareVersionBuild
If the output is
SoftwareVersionMajor = 10
SoftwareVersionMinor = 50
SoftwareVersionBuild = 2500
Then the version of database backup is 10.50.2500
SoftwareVersionMajor also gives an idea of the major version of SQL Server.
It helps to determine if the database backup is of SQL Server 2005 or SQL Server 2008.
 
Identify Database Backup Version
SoftwareVersionMajor = 9 backup is of SQL Server 2005
SoftwareVersionMajor = 8 backup is of SQL Server 2000
SoftwareVersionMajor = 10 and SoftwareVersionMinor = 0 backup is of SQL Server 2008
SoftwareVersionMajor = 10 and SoftwareVersionMinor = 50 backup is of SQL Server 2008 R2

No comments: