Functions/Data/Convert-SQLVersionToMajor.ps1
Function Convert-SQLVersionToMajor { [CmdletBinding()] Param ( [Parameter(Mandatory=$true)] [string] $Version ) Process { $SQLV = switch -Wildcard ($Version) { "15.*" {"2019"} "14.*" {"2017"} "13.*" {"2016"} "12.*" {"2014"} "11.*" {"2012"} "10.5*" {"2008 R2"} "10.4*" {"2008"} "10.3*" {"2008"} "10.2*" {"2008"} "10.1*" {"2008"} "9.*" {"2005"} "8.*" {"2000"} "7.*" {"7.0"} "6.*" {"6.0"} } $SQLMAJ = "Microsoft SQL Server $SQLV" } END { $SQLMAJ } } |