Check Internal Version of a .MDF File

When you have a detached .MDF file, you want to check the version number without modifying it. You can use a powershell script as below.
If you want to use the same script for a live database file, you need to take the database offline first.

  
  
 
 
 get-content -Encoding Byte "E:\MSSQL\testcs.mdf" | select-object -skip 0x12064 -first 2
84
3

PS H:> 3*256+64
852
## SQL Server 2016 SP1
 
 
 

 

How to determine the database version of an MDF file