@@Version - Transact SQL Configuration Functions

Applies to: yesSQL Server (all supported versions) YesAzure SQL Database YesAzure SQL Managed Instance yesAzure Synapse Analytics yesParallel Data Warehouse

Returns system and build information for the current installation of SQL Server.

Topic link icon Transact-SQL Syntax Conventions

Syntax

@@VERSION  

Note

To view Transact-SQL syntax for SQL Server 2014 and earlier, see Previous versions documentation.

Return Types

nvarchar

Remarks

The @@VERSION results are presented as one nvarchar string. You can use the SERVERPROPERTY (Transact-SQL) function to retrieve the individual property values.

For SQL Server, the following information is returned.

  • SQL Server version

  • Processor architecture

  • SQL Server build date

  • Copyright statement

  • SQL Server edition

  • Operating system version

For Azure SQL Database, the following information is returned.

  • Edition- "Microsoft SQL Azure"

  • Product level- "(RTM)"

  • Product version

  • Build date

  • Copyright statement

Note

We are aware of an issue where the product version reported by @@VERSION is incorrect for Azure SQL Database. The version of the SQL Server database engine run by Azure SQL Database is always ahead of the on-premises version of SQL Server, and includes the latest security fixes. This means that the patch level is always on par with or ahead of the on-premises version of SQL Server, and that the latest features available in SQL Server are available in Azure SQL Database.

To programmatically determine the engine edition, use SELECT SERVERPROPERTY('EngineEdition'). This query will return '5' for Azure SQL Database and '8' for Azure SQL Managed Instance.

We will update the documentation once this issue is resolved.

Examples

A: Return the current version of SQL Server

The following example shows returning the version information for the current installation.

SELECT @@VERSION AS 'SQL Server Version';  

Examples: Azure Synapse Analytics (SQL Data Warehouse) and Parallel Data Warehouse

B. Return the current version of Microsoft Azure Synapse Analytics (formerly SQL Data Warehouse)

SELECT @@VERSION AS 'SQL Server PDW Version';  

See Also

SERVERPROPERTY (Transact-SQL)