T-SQL Tutorial

SQL Server version

To get the version of Microsoft SQL Server that is currently running on your system, you can use a variety of methods and queries. The SQL Server version can be identified using the SERVERPROPERTY function, which provides information about the server's installation. Some of the important properties you can retrieve using SERVERPROPERTY include ProductLevel and EngineEdition.

Here are a few different ways to obtain the SQL Server version:

Using T-SQL Query

SQL Server Version: SQL Server is released in different versions, each with its own set of features, enhancements, and improvements. The SQL Server version is identified by a combination of a major version number and a build number.
SERVERPROPERTY Function: The SERVERPROPERTY function is a built-in T-SQL function in SQL Server that allows you to retrieve various properties and information about the SQL Server instance on which it is executed. You can use it to determine the version, edition, and other server-related details.
ProductLevel: The ProductLevel property returned by SERVERPROPERTY provides information about the update level of the SQL Server instance. It indicates whether the SQL Server installation is up-to-date with the latest service packs or cumulative updates. The ProductLevel values can include "RTM" (Release To Manufacturing), "SP1" (Service Pack 1), "CU" (Cumulative Update), and so on. This information is crucial for ensuring that your SQL Server installation is properly maintained and secured with the latest updates and patches.
EngineEdition: The EngineEdition property returned by SERVERPROPERTY indicates the edition of SQL Server that is installed. SQL Server is available in various editions, including Enterprise, Standard, Express, and more. The EngineEdition property helps you identify which edition is running on the server, which is important for licensing, scalability, and understanding the available features and limitations.

For example, to retrieve the SQL Server version, ProductLevel, and EngineEdition, you can use the following T-SQL query:

SERVERPROPERTY('ProductVersion') AS SQLServerVersion,
SERVERPROPERTY('ProductLevel') AS ProductLevel,
SERVERPROPERTY('EngineEdition') AS EngineEdition;

Using SQL Server Management Studio (SSMS)

Open SQL Server Management Studio.
Connect to the SQL Server instance you want to check.
In the Object Explorer, right-click on the server name, and select "Properties."
In the "General" section of the Properties window, you will find the "Product" and "Product Version" information, which will display the SQL Server version.

Remember that the exact method you choose may depend on your specific requirements and access permissions. Using T-SQL is typically the most common method when you have database access, but the other methods can be useful if you need to quickly check the SQL Server version from the operating system level.