Forked from indented-automation/Get-SqlVersionName.ps1
Created
February 8, 2017 17:00
-
-
Save fsackur/e8c8b5fe6af6702d846627fdeb3843cd to your computer and use it in GitHub Desktop.
SQL version lookup table
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-SqlVersionName { | |
param( | |
[Version]$Version | |
) | |
$lookup = @{ | |
'Name' = ('Major', 'Minor', 'RTM', 'SP1', 'SP2', 'SP3', 'SP4') | |
'2016' = ( 13, 0, 1601, 4001 ) | |
'2014' = ( 12, 0, 2000, 4100, 5000 ) | |
'2012' = ( 11, 0, 2100, 3000, 5058, 6020 ) | |
'2008 R2' = ( 10, 50, 1600, 2500, 4000, 6000 ) | |
'2008' = ( 10, 0, 1600, 2531, 4000, 5500, 6000) | |
'2005' = ( 9, 0, 1399, 2047, 3042, 4035, 5000) | |
'2000' = ( 8, 0, 194, 384, 532, 760, 2039) | |
'7.0' = ( 7, 0, 623, 699, 842, 961, 1063) | |
} | |
$versionName = $lookup.Keys | Where-Object { | |
$Version.Major -eq $lookup[$_][0] -and | |
$Version.Minor -eq $lookup[$_][1] } | |
'SQL Server {0} {1}' -f $versionName, | |
$lookup['Name'][$lookup[$versionName].IndexOf($Version.Build)] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment