How to Programmatically Determine Which Edition of SQL Server is Installed

There are times where you might want to programmatically determine which edition of SQL Server is running.  When I say “Edition” I don’t mean are you running SQL Server 2012, 2014, 2016, or some other major release of SQL Server.   What I mean is are you running standard, enterprise, or developer edition.  

To get the version of SQL Server programmatically there are a couple of different options.  The first method I will show you is using the @@VERSION system function.  This system function will provide you the system and build information for SQL Server.  To use the @@VERSION function you can perform this Transact-SQL:

SELECT @@VERSION;

When I run this code, I get the following results from one of my SQL Server instances:

-----------------------------------------------------------------------
Microsoft SQL Server 2016 (RTM-GDR) (KB3194716) - 13.0.1722.0 (X64) 
       Sep 26 2016 13:17:23 
       Copyright (c) Microsoft Corporation
       Enterprise Edition (64-bit) on Windows 10 Home 6.3 <X64> (Build 14393: )
Another way to return what edition you are running is to use the SERVERPROPERTY function.   This function accepts propertyname as a parameter.  To return the version and edition information you can run the following code:
SELECT SERVERPROPERTY('ProductVersion') as [ProductVersion]
      ,SERVERPROPERTY('Edition') AS [Edition];

When I run this code the following output is displayed:
ProductVersion     Edition ----------------------------------------------------------------------- 13.0.1722.0        Enterprise Edition (64-bit)  

See all articles by Greg Larsen

Gregory Larsen
Gregory Larsen
Gregory A. Larsen is a DBA at Washington State Department of Health (DOH). Greg is responsible for maintaining SQL Server and other database management software. Greg works with customers and developers to design and implement database changes, and solve database/application related problems. Greg builds homegrown solutions to simplify and streamline common database management tasks, such as capacity management.

Get the Free Newsletter!

Subscribe to Cloud Insider for top news, trends & analysis

Latest Articles