แก้ไข

แชร์ผ่าน


@@VERSION - Transact SQL Configuration Functions

Applies to: SQL Server Azure SQL Database Azure SQL Managed Instance Azure Synapse Analytics Analytics Platform System (PDW)

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

Transact-SQL syntax conventions

Important

The Database Engine version numbers for SQL Server and Azure SQL Database are not comparable with each other, and represent internal build numbers for these separate products. The Database Engine for Azure SQL Database is based on the same code base as the SQL Server Database Engine. Most importantly, the Database Engine in Azure SQL Database always has the newest SQL Database Engine bits. For example, version 12 of Azure SQL Database is newer than version 16 of SQL Server.

Syntax

@@VERSION

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 and Azure SQL Managed Instance, the following information is returned.

  • Edition- "Microsoft SQL Azure"

  • Product level- "(RTM)"

  • Product version

  • Build date

  • Copyright statement

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 and Analytics Platform System (PDW)

B. Return the current version of Azure Synapse Analytics

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