Database Journal
MS SQL Oracle DB2 Access MySQL PostgreSQL Sybase PHP SQL Etc SQL Scripts & Samples Links Database Forum

» Database Journal Home
» Database Articles
» Database Tutorials
MS SQL
Oracle
DB2
MS Access
MySQL
» RESOURCES
Database Tools
SQL Scripts & Samples
Links
» Database Forum
» Slideshows
» Sitemap
Free Newsletters:
DatabaseDaily  
News Via RSS Feed


follow us on Twitter
Database Journal |DBA Support |SQLCourse |SQLCourse2
 

Featured Database Articles

Database User and Programming Tips

Posted February 2, 2017

How to Programmatically Determine Which Edition of SQL Server is Installed

By Greg Larsen

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



Database User and Programming Tips Archives

Comment and Contribute

 


(Maximum characters: 1200). You have characters left.