How to Programmatically Determine Which Edition of SQL Server is Installed | Database Journal

How to Programmatically Determine Which Edition of SQL Server is Installed

Written By
Gregory Larsen
Gregory Larsen
Feb 2, 2017
1 minute read

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 parameterTo 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 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.

Database Journal Logo

DatabaseJournal.com publishes relevant, up-to-date and pragmatic articles on the use of database hardware and management tools and serves as a forum for professional knowledge about proprietary, open source and cloud-based databases--foundational technology for all IT systems. We publish insightful articles about new products, best practices and trends; readers help each other out on various database questions and problems. Database management systems (DBMS) and database security processes are also key areas of focus at DatabaseJournal.com.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.