Identifying SQL Server Version
DECLARE @SQLRelease VARCHAR(15);
SET @SQLRelease = 'UNKNOWN'
IF LEFT(CAST(SERVERPROPERTY('ProductVersion') As Varchar),1)='8'
SET @SQLRelease = 'SQLServer2000'
IF LEFT(CAST(SERVERPROPERTY('ProductVersion') As Varchar),1)='9'
SET @SQLRelease = 'SQLServer2005'
IF LEFT(CAST(SERVERPROPERTY('ProductVersion') As Varchar),2)='10'
SET @SQLRelease = 'SQLServer2008'
SELECT @SQLRelease as ReleaseLevel
, SERVERPROPERTY('ProductLevel') AS ProductLevel
, SERVERPROPERTY('Edition') AS Edition;
We are working upon a central Server Inventory solution and needed to capture for SQLServer details. Surprisingly, there are many script-lets out there to capture Product Version, but not much details around what it maps to (unless you want to keep a table running with you to interpret numbers again SQL Server Product version). Hence the quick script above which can tell you Product Version in more humanly manner, along with SP and Edition details.