SQL Server 2016 - How To Detect The Current Cumulative Update/Service Pack That Was Installed

In this article, I will explain how to detect the current Cumulative Update / Service Pack installed on your SQL Server.

Detect the Current Cumulative Update / Service Pack Installed

You can use the ServerProperty as a system defined function to return the SQL Server Instance information like the ProductLevel and ProductUpdateLevel.

The ProductLevel returns the version level of the SQL Server instance as the following.

  • 'RTM' = Original release version
  • 'SPn' = Service pack version
  • 'CTPn', = Community Technology Preview version

Example

  1. select SERVERPROPERTY('ProductLevel') as 'Product Level'

The ProductUpdateLevel returns the update level of the current build as CUn where the CU=Cumulative Update.

Example

  1. select SERVERPROPERTY('ProductUpdateLevel') as 'ProductUpdate Level'

Note

The ProductUpdateLevel is available in the SQL Server 2012 through current version in updates beginning from late 2015.

For more details, check the T-SQL: Get SQL Server Instance Information Using SERVERPROPERTY

Below, we will show how to detect the current Cumulative Update / Service Pack in case the current version doesn't support the ProductUpdateLevel.

Get the current SQL Server Version

You have multiple ways to get the current SQL Server version -

Using SQL Server Management Studio
  • Open SQL Server Management Studio > Connect to SQL Server.
  • Right-click on Server Name > Properties.
  • In "General" section, check the Version field number.


Using SQL Server Configuration Manager
  • Open SQL Server Configuration Manager.
  • From right side, open SQL Server Services.
  • Right-click on SQL Server Instance name and select Properties.
  • Click on Advanced Tab and scroll down to the version field number.


Using T-SQL
  1. Select @@version


Using WindowsPowerShell

You can use Windows PowerShell to invoke SQL command on a reachable server within the network using Invoke-Sqlcmd cmdlet as the following.

  • Open Windows PowerShell as Administrator.
  • Type the Invoke-Sqlcmd with the below parameters.

    • -query: the SQL query that you need to run on the remote server.
    • -ServerInstance: the SQL server instance name.
    • -Username: the username that has sufficient permission to access and execute SQL query on the remote server.
    • -Password: the password of the elevated user.
  1. PS SQLSERVER:\> Invoke-Sqlcmd -query "select SERVERPROPERTY('MachineName') as 'MachineName'" -ServerInstance "epm\epmdb" -Username sa -Password *****

No matter what method you have used to get the version number, you should now be able to detect the current Cumulative Update / Service Pack, as the following.

Applied To
  • SQL Server 2017.
  • SQL Server 2016.
  • SQL Server 2014.
  • SQL Server 2012.
Conclusion

In this article, we saw how to get the current Cumulative Update / Service Pack installed in SQL Server.

Reference

Up Next
    Ebook Download
    View all
    Learn
    View all