How to Check SQL Server Version: A Quick Guide

By Cristian G. Guasch • Updated: 05/17/23 • 20 min read

When working with SQL Server, it’s important to know which version and edition you are running. This information can be useful for troubleshooting issues, determining compatibility with other software, and planning upgrades. Fortunately, there are several ways to check the SQL Server version and edition.

One of the easiest methods is to use SQL Server Management Studio (SSMS). Simply connect to the server instance, right-click on the instance name, and select Properties. In the General section, you will see information such as the product version, product level, and edition. Another method is to run a query against the server instance using SQL Server Management Studio. By running the query “SELECT @@VERSION”, you can retrieve the version and edition information.

Using SQL Server Management Studio

SQL Server Management Studio (SSMS) is a popular tool used by database administrators to manage SQL Server instances. It provides a graphical user interface to manage various aspects of SQL Server, including viewing server properties and version information.

Viewing SQL Server Version Details

To view the version information of SQL Server using SSMS, follow these steps:

  1. Open SSMS and connect to the SQL Server instance you want to check.
  2. In the Object Explorer window, right-click on the server name and select Properties.
  3. In the Server Properties window, select the General page.
  4. The version information is displayed in the Product field, along with other details such as the edition, build number, and operating system.

Alternatively, you can also view the version information by executing a T-SQL query in SSMS. Open a new query window and execute the following query:

SELECT @@VERSION AS 'SQL Server Version'

This will display the version information in the query results pane.

It is important to note that the version information displayed in SSMS may not always be accurate or up-to-date. In some cases, the version information may be cached and not reflect the most recent changes to the SQL Server instance. To ensure that you always have the latest version information, it is recommended to also check the SQL Server error log or use other methods to verify the version information.

In summary, SSMS provides a convenient way to view the version information of SQL Server instances. By following the steps outlined above, you can quickly and easily view the version details of your SQL Server instance.

Using Transact-SQL

Transact-SQL is another way to check the SQL Server version. This method involves executing a query against the SQL Server instance. There are two ways to use Transact-SQL to check the SQL Server version: using the SELECT @@VERSION function or using the SERVERPROPERTY function.

Using SELECT @@VERSION

The SELECT @@VERSION function returns the version of the SQL Server instance. To use this function, open a new query window in SQL Server Management Studio and execute the following query:

SELECT @@VERSION

The result of this query will display the version of the SQL Server instance in the following format:

Microsoft SQL Server <version> - <edition> (<build number>) <OS info>

The version number is displayed in the format major.minor.build.revision. For example, 14.0.1000.169 represents SQL Server 2017.

Using SERVERPROPERTY Function

The SERVERPROPERTY function returns various properties of the SQL Server instance. To use this function to check the SQL Server version, execute the following query:

SELECT SERVERPROPERTY('ProductVersion')

The result of this query will display the version of the SQL Server instance in the following format:

<major version>.<minor version>.<build number>.<revision number>

For example, 14.0.1000.169 represents SQL Server 2017.

In addition to the ProductVersion property, there are other properties that can be used with the SERVERPROPERTY function to retrieve information about the SQL Server instance. Some of these properties include:

  • ProductLevel: returns the service pack level of the SQL Server instance.
  • Edition: returns the edition of the SQL Server instance.
  • InstanceName: returns the name of the SQL Server instance.

To retrieve the value of a specific property, replace ProductVersion in the query above with the name of the desired property.

Overall, using Transact-SQL to check the SQL Server version is a straightforward process that can be done using either the SELECT @@VERSION function or the SERVERPROPERTY function.

Using PowerShell

PowerShell is a powerful tool for managing and automating tasks in Windows environments. It is also a great way to check the version of SQL Server installed on a machine. Here are a few ways to do that:

Using Invoke-Sqlcmd

One way to check the SQL Server version using PowerShell is by using the Invoke-Sqlcmd cmdlet. This cmdlet allows you to execute SQL commands and scripts against a SQL Server instance. Here’s an example of how to use it to get the version of SQL Server:

Invoke-Sqlcmd -ServerInstance "ServerName" -Query "SELECT @@VERSION"

Replace “ServerName” with the name of the SQL Server instance you want to check. The command will return the version of SQL Server installed on that instance.

You can also use the Invoke-Sqlcmd cmdlet to check the version of SQL Server for multiple instances at once. Here’s an example of how to do that:

$instances = "ServerName1", "ServerName2", "ServerName3"
foreach ($instance in $instances) {
    Write-Host "Checking version for $instance"
    Invoke-Sqlcmd -ServerInstance $instance -Query "SELECT @@VERSION"
}

This will loop through each instance in the $instances array and check the version of SQL Server for each one.

In addition to checking the version of SQL Server, you can also use the Invoke-Sqlcmd cmdlet to execute other SQL commands and scripts. For example, you can use it to create a new database or query data from an existing database.

Overall, PowerShell is a great tool for managing and automating tasks in Windows environments, including checking the version of SQL Server. The Invoke-Sqlcmd cmdlet is a powerful tool for executing SQL commands and scripts against a SQL Server instance.

Using Windows Command Prompt

To check the SQL Server version using the Windows Command Prompt, one can use the SQLCMD utility. SQLCMD is a command-line tool that allows users to connect to SQL Server instances and execute SQL queries. The following sub-sections explain how to use SQLCMD to check the SQL Server version.

Using SQLCMD

To use SQLCMD, open the Windows Command Prompt and type “SQLCMD” followed by the server name and instance name. For example, if the server name is “MyServer” and the instance name is “MyInstance”, the command would be:

SQLCMD -S MyServer\MyInstance

Once connected, type “SELECT @@VERSION” and press Enter. The SQL Server version information will be displayed on the command prompt.

Microsoft SQL Server 2017 (RTM-CU15) (KB5001090) - 14.0.3294.2 (X64)
	Apr 12 2021 17:45:00
	Copyright (C) 2017 Microsoft Corporation
	Developer Edition (64-bit) on Windows 10 Pro 10.0 <X64> (Build 19043: )

Alternatively, one can use the following command to save the output to a file:

SQLCMD -S MyServer\MyInstance -Q "SELECT @@VERSION" -o C:\Version.txt

This will save the SQL Server version information to a file named “Version.txt” in the C:\ directory.

In summary, one can use SQLCMD in the Windows Command Prompt to check the SQL Server version. By following the above steps, users can quickly and easily obtain the version information they need.

Using SQL Server Configuration Manager

SQL Server Configuration Manager is a tool that allows users to manage SQL Server services and configurations. It is a useful tool for checking the version of SQL Server that is installed on a machine.

Viewing SQL Server Version Details

To view SQL Server Version Details using SQL Server Configuration Manager, follow these steps:

  1. Open SQL Server Configuration Manager by typing “SQLServerManager<version>.msc” in the Search charm and pressing Enter. For example, if the version is SQL Server 2016, type “SQLServerManager13.msc”.
  2. In the left pane of SQL Server Configuration Manager, select “SQL Server Services”. This will display all the SQL Server services that are installed on the machine.
  3. Right-click on the SQL Server service that you want to check the version for and select “Properties”.
  4. In the “Properties” window, select the “Advanced” tab.
  5. Look for the “Version” field in the “Property” column. This will display the version of SQL Server that is installed on the machine.
  6. You can also check the “Edition” field to determine the edition of SQL Server that is installed.
  7. Click “OK” to close the “Properties” window.

It is important to note that SQL Server Configuration Manager can only display the version of SQL Server that is installed on the machine. It cannot be used to determine the version of SQL Server that is running on a remote machine.

In conclusion, SQL Server Configuration Manager is a useful tool for checking the version of SQL Server that is installed on a machine. By following the steps outlined above, users can easily view SQL Server Version Details.

Using Services.msc

One way to check the SQL Server version is by using the Services.msc utility. This is a Microsoft Management Console snap-in that allows users to view and manage system services. Here’s how to use it to check the SQL Server version:

Viewing SQL Server Version Details

  1. Open the Run dialog box by pressing the Windows key + R.
  2. Type “services.msc” and press Enter.
  3. Scroll down to find the SQL Server service you want to check.
  4. Right-click on the service and select Properties.
  5. In the Properties dialog box, click on the General tab.
  6. Look for the Service name and note the version number listed in parentheses next to it.

It’s important to note that this method only shows the version number of the SQL Server service. It does not provide any additional details about the edition or other components of SQL Server. For more detailed information, users should consider using other methods such as SQL Server Management Studio or querying the system tables.

In summary, using Services.msc is a quick and simple way to check the version number of a SQL Server service. However, users should keep in mind that it only provides limited information and may not be sufficient for more detailed analysis.

Using SQL Server Error Logs

SQL Server error logs are essential tools for troubleshooting issues that arise within SQL Server. The logs provide valuable information about the server’s health and performance. In this section, we will discuss how to view SQL Server version details using error logs.

Viewing SQL Server Version Details

One of the most common reasons for viewing SQL Server error logs is to determine the version of SQL Server running on a particular instance. There are several ways to do this, but one of the easiest is to look at the first few lines of the error log file.

To view the error log file, you can use SQL Server Management Studio or any text editor. By default, the error log is located at Program Files\Microsoft SQL Server\MSSQL.n\MSSQL\LOG\ERRORLOG and ERRORLOG.n files.

Once you have opened the error log file, look for the following lines:

2019-06-20 10:50:24.12 Server      Microsoft SQL Server 2016 (SP1) (KB3182545) - 13.0.4001.0 (X64)

The line above shows that the instance is running SQL Server 2016 Service Pack 1 with KB3182545 installed. The version number is 13.0.4001.0 (X64). This information is useful when troubleshooting issues or when installing updates or service packs.

Another way to view SQL Server version details is to connect to the server using Object Explorer in SQL Server Management Studio. After Object Explorer is connected, it will show the version information in parentheses, together with the user name that is used to connect to the specific instance of SQL Server.

In conclusion, SQL Server error logs are valuable sources of information about the server’s health and performance. By viewing the error logs, you can determine the version of SQL Server running on a particular instance, which is useful when troubleshooting issues or when installing updates or service packs.

Determining SQL Server Version with T-SQL Script

A T-SQL script is a set of SQL commands that can be executed in a batch. It is a useful tool for database administrators to automate tasks and perform routine checks. One of the tasks that can be performed with T-SQL script is determining the SQL Server version.

To determine the SQL Server version with T-SQL script, follow these steps:

  1. Open SQL Server Management Studio (SSMS) and connect to the SQL Server instance.
  2. Open a new query window by clicking on “New Query” button.
  3. Type the following T-SQL script in the query window:
SELECT @@VERSION AS 'SQL Server Version'
  1. Execute the script by clicking on “Execute” button or pressing F5.
  2. The result will be displayed in the “Results” pane. It will show the SQL Server version, edition, and other information.

Here is an example of the result:

SQL Server Version
Microsoft SQL Server 2019 (RTM-CU1) (KB5001090) – 15.0.4123.1 (X64) Mar 22 2021 19:08:15 Copyright (C) 2019 Microsoft Corporation Developer Edition (64-bit) on Windows 10 Pro 10.0 <X64> (Build 19042: )

The T-SQL script uses the @@VERSION function to return the SQL Server version information. This function returns a string that contains version, edition, and other information about the SQL Server instance.

In addition to @@VERSION function, there are other T-SQL functions that can be used to determine the SQL Server version, such as SERVERPROPERTY and @@MICROSOFTVERSION. However, @@VERSION is the simplest and easiest to use.

In conclusion, using T-SQL script to determine the SQL Server version is a quick and easy way for database administrators to check the version of their SQL Server instance. It provides valuable information that can be used for troubleshooting, maintenance, and upgrade planning.

Determining SQL Server Version with Installed SQL Server Features Discovery Report

One way to determine the version of SQL Server installed on a system is by using the Installed SQL Server Features Discovery Report. This report provides information about the features installed on the system, including the version of SQL Server.

To access the report, click “Tools” on the left-hand navigation area of SQL Server Installation Center, and then click “Installed SQL Server features discovery report.” The report is saved to %ProgramFiles%\Microsoft SQL Server\nnn\Setup Bootstrap\Log\<last Setup Session>, where nnn is the version number of SQL Server installed on the system.

The report is saved as an HTML file named SqlDiscoveryReport.htm. The report provides information about the SQL Server installation, including the version number, edition, and build number. It also lists the features installed on the system, such as the Database Engine, Analysis Services, Reporting Services, and Integration Services.

The report provides a wealth of information about the SQL Server installation, including the version number, edition, and build number. It also lists the features installed on the system, such as the Database Engine, Analysis Services, Reporting Services, and Integration Services.

Using the Installed SQL Server Features Discovery Report is a quick and easy way to determine the version of SQL Server installed on a system. It is particularly useful when working with multiple instances of SQL Server, as it allows you to quickly identify which version of SQL Server is installed on each instance.

Determining SQL Server Version with SQL Server Properties

One way to determine the version of SQL Server is to use the SERVERPROPERTY function. This function returns various properties of the SQL Server instance, such as the product version, product level, product name, edition, and more.

To use the SERVERPROPERTY function, open SQL Server Management Studio and connect to the SQL Server instance you want to check. Then, open a new query window and execute the following query:

SELECT 
    SERVERPROPERTY('ProductVersion') AS ProductVersion,
    SERVERPROPERTY('ProductLevel') AS ProductLevel,
    SERVERPROPERTY('ProductMajorVersion') AS ProductMajorVersion,
    SERVERPROPERTY('ProductMinorVersion') AS ProductMinorVersion,
    SERVERPROPERTY('ProductName') AS ProductName,
    SERVERPROPERTY('Edition') AS Edition,
    SERVERPROPERTY('BuildClrVersion') AS BuildClrVersion,
    SERVERPROPERTY('SqlCharSet') AS SqlCharSet,
    SERVERPROPERTY('Collation') AS Collation,
    SERVERPROPERTY('BuildNumber') AS BuildNumber,
    SERVERPROPERTY('SqlSortOrder') AS SqlSortOrder,
    SERVERPROPERTY('FileDescription') AS FileDescription,
    SERVERPROPERTY('FileVersion') AS FileVersion,
    SERVERPROPERTY('ProductBuildType') AS ProductBuildType,
    SERVERPROPERTY('SqlBuildNumber') AS SqlBuildNumber,
    SERVERPROPERTY('BuildType') AS BuildType,
    SERVERPROPERTY('SqlSortOrder') AS SqlSortOrder,
    SERVERPROPERTY('SqlCharSet') AS SqlCharSet,
    SERVERPROPERTY('SqlCharSetName') AS SqlCharSetName,
    SERVERPROPERTY('SqlSortOrderName') AS SqlSortOrderName,
    SERVERPROPERTY('SqlSortOrderName') AS SqlSortOrderName,
    SERVERPROPERTY('SqlCharSetName') AS SqlCharSetName

This query returns a table with the properties of the SQL Server instance. Here is an explanation of some of the important properties:

  • ProductVersion: The version number of the SQL Server instance, in the format of major.minor.build.revision.
  • ProductLevel: The service pack level of the SQL Server instance.
  • ProductName: The name of the SQL Server product.
  • Edition: The edition of the SQL Server instance, such as Enterprise, Standard, or Express.
  • BuildNumber: The build number of the SQL Server instance.
  • FileDescription: The description of the SQL Server executable file.
  • FileVersion: The version number of the SQL Server executable file.

By using the SERVERPROPERTY function, you can easily determine the version and other properties of the SQL Server instance.

Determining SQL Server Version with SP_SERVER_INFO

One way to determine the version of SQL Server that is running is by using the sp_server_info system stored procedure. This procedure returns information about the SQL Server instance, including the version number.

To use sp_server_info, follow these steps:

  1. Open SQL Server Management Studio and connect to the instance of SQL Server that you want to check.
  2. Open a new query window and execute the following command: EXEC sp_server_info; This command will return a table with several columns, including one called attribute_name and another called attribute_value. The version number can be found in the row where attribute_name is 'ProductVersion'.
  3. Alternatively, you can use the following command to return only the version number: EXEC sp_server_info 'ProductVersion'; This command will return a single row with the version number in the attribute_value column.

It is important to note that sp_server_info returns information about the instance of SQL Server that it is executed on, not necessarily the entire SQL Server environment. If there are multiple instances of SQL Server running, this procedure will need to be executed on each one individually to determine the version number for each instance.

Overall, sp_server_info is a quick and easy way to determine the version of SQL Server that is running on a particular instance. It can be especially useful when working with legacy systems or when access to other methods of determining the version number is restricted.

Determining SQL Server Version with Registry Keys

One of the ways to determine the version of SQL Server installed on a system is by checking the registry keys. The following steps outline how to check SQL Server version using registry keys:

  1. Open the Windows registry editor by typing “regedit” in the Run dialog box.
  2. Navigate to the following registry key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\
  3. Under this key, there will be subkeys for each version of SQL Server installed on the system. The subkey will be named by the version number (e.g. 90 for SQL Server 2005, 100 for SQL Server 2008, 110 for SQL Server 2012, etc.).
  4. Within each subkey, there will be a value named “ProductVersion” that contains the version number of SQL Server. This value will be in the format of “major.minor.build.revision” (e.g. 10.0.1600.22 for SQL Server 2008).

It is important to note that the registry key method may not always be accurate, especially in cases where there are multiple instances of SQL Server installed on the system. In such cases, it is recommended to use other methods like querying the SQL Server error log or using SQL Server Management Studio (SSMS).

Additionally, it is important to note that the registry key method only provides information about the SQL Server version and not the product version or service pack level. To determine the product version and service pack level, it is recommended to use other methods like querying the “SELECT @@VERSION” command in SSMS or using the “SELECT SERVERPROPERTY(‘productversion’), SERVERPROPERTY(‘productlevel’), SERVERPROPERTY(‘edition’)” command in SQL Server Management Studio.

In summary, checking the registry keys is a quick and easy way to determine the version of SQL Server installed on a system. However, it may not always be accurate and should be used in conjunction with other methods to ensure accuracy.

Determining SQL Server Version with Support Lifecycle

When working with SQL Server, it’s important to know which version is installed on your system. There are various methods to determine the version of SQL Server, including querying the server or using the SQL Server Management Studio.

It’s also important to keep in mind the support lifecycle of each version. Each version of SQL Server is backed by a minimum of 10 years of support, which includes five years in mainstream support and five years in extended support. Mainstream support includes functional, performance, scalability, and security updates, while extended support only includes security updates.

To determine the version of SQL Server, you can use any of the following methods:

  • Query the server using the @@version function. This will display the version and build number of SQL Server.
  • Use the SQL Server Management Studio to connect to the server and view the version information in the Object Explorer.
  • Check the Windows Registry for the version information.

It’s important to keep in mind the support lifecycle of each version of SQL Server. Microsoft provides mainstream support for a product for 5 years after its initial release. This means that for the first 5 years, you may see new smaller features or enhancements added to the product along with any bug fixes and security patches. After the 5-year period, the product enters into extended support, which only includes security updates.

It’s recommended to upgrade to a newer version of SQL Server before the end of mainstream support to ensure continued support and access to the latest features and enhancements. Microsoft provides a detailed support lifecycle policy for each version of SQL Server, which includes information on the end of mainstream and extended support dates.

In summary, determining the version of SQL Server is an important step when working with the database engine. It’s also important to keep in mind the support lifecycle of each version to ensure continued support and access to the latest features and enhancements.

Conclusion

In conclusion, checking the SQL Server version is a critical task for any database administrator. Knowing the version and edition of SQL Server can help in troubleshooting issues, applying service packs or cumulative updates, and ensuring compatibility with other tools and applications.

There are several ways to check the SQL Server version, including querying the @@version system function using a SQL query, checking the version information in SQL Server Management Studio, or looking at the first few lines of the Errorlog file. The SQL Server Configuration Manager and SQL Server Installation Center can also provide version information and other details about the SQL Server instance.

It is important to keep the SQL Server version up-to-date by applying the latest service packs, cumulative updates, and security updates. Microsoft releases new versions of SQL Server regularly, with the latest version being Microsoft SQL Server 2019. Powershell can also be used to automate the process of checking the SQL Server version and applying updates.

It is also important to understand the different SQL Server editions, such as the Enterprise Edition, Standard Edition, and Express Edition, and their respective features and limitations. Knowing the SQL Server version and edition can also help in deciding whether to migrate to Azure or other cloud platforms.

In summary, checking the SQL Server version and keeping it up-to-date is crucial for maintaining a healthy and secure database environment. By using the various tools and methods available, database administrators can ensure that their SQL Server instances are running smoothly and efficiently.

Related articles