تحرير

مشاركة عبر


@@VERSION (Transact SQL)

Applies to: SQL Server Azure SQL Database Azure SQL Managed Instance Azure Synapse Analytics Analytics Platform System (PDW) SQL analytics endpoint in Microsoft Fabric Warehouse in Microsoft Fabric SQL database in Microsoft Fabric

The @@VERSION configuration function returns information about the system and SQL Server build information.

Transact-SQL syntax conventions

Important

The Database Engine version numbers for SQL Server and Azure SQL Database aren't comparable with each other, and represent internal build numbers for these separate products. For more information, see the Remarks section.

Syntax

@@VERSION

Return types

nvarchar

Remarks

  • The Database Engine version numbers for SQL Server and Azure SQL Database aren't 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.

  • The @@VERSION results appear as one nvarchar string. Use the SERVERPROPERTY function to get the individual property values.

  • For SQL Server, the @@VERSION results include:

    • SQL Server version

    • Processor architecture

    • SQL Server build date

    • Copyright statement

    • SQL Server edition

    • Operating system version

      The operating system version information comes from the host, virtual machine, or container where SQL Server is installed. It doesn't necessarily reflect the retail version of the underlying operating system. For information about querying Windows version information using the WMI Query Language (WQL), see Win32_OperatingSystem class.

  • For Azure SQL Database and Azure SQL Managed Instance, the @@VERSION results include:

    • 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 the version information for an installation of SQL Server 2025 (17.x). Depending on the underlying host, virtual machine, or container operating system, the command returns different information.

SELECT @@VERSION AS 'SQL Server Version';
  • Windows Server 2019 virtual machine:

    Microsoft SQL Server 2025 (RTM) - 17.0.1000.7 (X64)
    Oct 21 2025 12:05:57
    Copyright (C) 2025 Microsoft Corporation
    Enterprise Developer Edition (64-bit) on Windows Server 2019 Standard 10.0 <X64> (Build 17763: ) (Hypervisor)
    
  • Windows 11 virtual machine:

    Microsoft SQL Server 2025 (RTM) - 17.0.1000.7 (X64)
    Oct 21 2025 12:05:57
    Copyright (C) 2025 Microsoft Corporation
    Enterprise Developer Edition (64-bit) on Windows 10 Enterprise 10.0 <X64> (Build 26220: ) (VM)
    

    In this example, the output doesn't necessarily reflect the retail version of the operating system.

  • Ubuntu Linux 24.04:

    Microsoft SQL Server 2025 (RTM) - 17.0.1000.7 (X64)
    Oct 21 2025 12:05:57
    Copyright (C) 2025 Microsoft Corporation
    Enterprise Developer Edition (64-bit) on Linux (Ubuntu 24.04.3 LTS) <X64>
    

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';