Determining which version and edition of SQL Server Database Engine is running

This sample demonstrates how to determine the version and edition of SQL Server Database Engine that is running by SQL Script.

4.3 Star
36,536 times
Add to favorites
E-mail Twitter Digg Facebook
Sign in to ask a question

  • SQL 2016 incorrect information
    1 Posts | Last post August 13, 2019
      On a SQL 2016 SP2-GDR server, the advice is to install the latest service pack SP1 !
      Also advises that the latest CU is CU7. CU8 has been released.
      Microsoft SQL Server 2016 (SP2-GDR) (KB4293802) - 13.0.5081.1 (X64) 
      	Jul 20 2018 22:12:40 
      	Copyright (c) Microsoft Corporation
      	Web Edition (64-bit) on Windows Server 2012 R2 Standard 6.3 <X64> (Build 9600: )
      --//Recommended updates: 
      --### RTM -> QFE or GDR
      --### SP  -> QFE or GDR
      --### QFE -> QFE
      --### GDR -> GDR or QFE
      Install the latest service pack:              SP1, <>
      Install the latest Cumulative Update (CU) of SP1:  CU7, <>
  • in description in sapmle ouputs
    1 Posts | Last post December 06, 2018
    • i want out find out the  which licensing model i have bought like core based or server+CAL model licensing   in ur description it is showing the core based model 
      but whe i execute same query i didnt get anything except standard edition
  • Version 2/23/2018 is missing SQL Server 2016 SP2 CU3
    2 Posts | Last post November 06, 2018
    • When checking a newly built SQL 2016 SP2 saw incorrect results.  I've updated the script to include the necessary information to correctly detect the latest SQL 2016 SP and CU but don't know how to submit those changes for review.  Please advise.  Thanks!
    • Found the Upload a contribution Link but my company blocks access for outbound uploads.
  • Version 12/13/2017 missing SQL Server 2014 SP2 CU9
    1 Posts | Last post January 12, 2018
    • The latest version reports that SQL Server 2014's latest CU for SP2 is CU8, and CU9 is currently available.
  • Version 10/27/2017
    1 Posts | Last post November 29, 2017
    • Doesn't show the CU2 update from SQL Server 2017
  • Report is Empty
    1 Posts | Last post July 20, 2017
    • So forgive me, I am new to this. I have downloaded the ZIP and imported the sql query into report builder - using SQL 2016.
      When I initially try to run the query - I get an error about the incorrect syntax at 'GO' so I remove that word.
      Click Ok.
      Nothing shows up - nothing in the data set. 
      If I click ! in the query designer - nada.
      What am I missing here?
  • Possible 'typo' and 'cannot execute on SQL 2005'
    2 Posts | Last post August 23, 2016
    • Incorrect syntax near '+' when running on SQL 2005 and there is possibily an issue in the 
      IF (@ProductName = 'SQL Server 2005') section 
      which references 9.00.5057 as SQL 2008 this is repeated on a few others
      + CHAR(13) + '9.00.5057 (SQL Server 2008 SP4 GDR)'
      Apologies if I'm wrong.
    • Hi Macca,
      Thanks for your question.Since the sql syntax on SQL Server 2005 is not compatible with the newer version, this script can't run on SQL Server 2005, please use the new version SQL Server instead.
  • Product latest version with CU And patch Info
    3 Posts | Last post December 02, 2015
    •  WHEN '12.0' THEN 'SQL Server 2014 SP1 CU3'
      So even I have installed base version of 2014 sql server, CONVERT(NVARCHAR(20),SERVERPROPERTY('ProductVersion'))  will return 12.0.xxxxxx
      and query above will always show it as CU3 of SP1.
      I wanted to get the CU and SP correct info.
      is there any other way please suggest.
    • Hi Bahushekh
      SQL Server 2014 latest version number is 12.0.4427.24(SQL Server 2014 SP1 CU3). If you have not installed the latest CU, we will always recommend that you install.
      To get the CU when the following conditions.Using SELECT ISNULL(CONVERT(NVARCHAR(20),SERVERPROPERTY('ProductUpdateLevel')),''). More information read this KB 
      •SQL Server 2014 RTM CU10 and later versions
      •SQL Server 2014 Service Pack 1 CU3 and later versions
      •SQL Server 2012 Service Pack 2 CU7 and later versions
      Thank you for suggest.
    • Thanks OneScript for your time.
       Yes I have installed and now I can see the version information.
      Very helpful post and response.