How to check SQL Server version: every method in one table
The quickest way to check the SQL Server version is to connect to the instance and run SELECT @@VERSION;. It returns one line with the product name (for example SQL Server 2022), the update level (such as RTM-CU14), the build number, the edition and the operating system. If you cannot connect, the error log and the Windows registry hold the same information. Microsoft's support article on finding your version and edition lists these methods; this table adds the command-line and Linux options.
| Method | What you run or open | Needs a connection? | Best for |
|---|---|---|---|
| T-SQL one-liner | SELECT @@VERSION; | Yes | A fast answer in any query window |
| T-SQL properties | SERVERPROPERTY('ProductVersion'), 'ProductLevel', 'ProductUpdateLevel', 'Edition' | Yes | Scripts, inventories, monitoring |
| SSMS | Object Explorer, or right-click the server and choose Properties | Yes | A quick visual check |
| sqlcmd | sqlcmd -S localhost -Q "SELECT @@VERSION" | Yes | Servers without SSMS, and Linux |
| PowerShell | Invoke-Sqlcmd -ServerInstance localhost -Query "SELECT @@VERSION" | Yes | Checking many servers in one script |
| Error log | First lines of ERRORLOG (Windows) or /var/opt/mssql/log/errorlog (Linux) | No | An instance that will not start |
| Registry | HKLM\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL{nn}.<instance>\Setup | No | Offline checks on Windows |
| Linux package | apt list --installed mssql-server or yum info mssql-server | No | Linux servers |
SELECT @@VERSION: check SQL Server version with a query
Open a new query window in SQL Server Management Studio (SSMS), Azure Data Studio, VS Code or any other client, connect to the instance, and run:
SELECT @@VERSION;
Microsoft's own example output for SQL Server 2022 looks like this:
Microsoft SQL Server 2022 (RTM-CU14) (KB5038325) - 16.0.4135.4 (X64)
Jul 10 2024 14:09:09
Copyright (C) 2022 Microsoft Corporation
Developer Edition (64-bit) on Windows 11 Enterprise 10.0 <X64> (Build 22631: ) (Hypervisor)
Read it from left to right:
- Microsoft SQL Server 2022 is the product version, the name you would use in conversation.
- (RTM-CU14) is the update level: the original release (RTM) plus cumulative update 14.
- (KB5038325) is the Microsoft Knowledge Base article for that update.
- 16.0.4135.4 is the build number, in
major.minor.build.revisionform. The major number, 16, means SQL Server 2022. - Developer Edition (64-bit) is the edition.
- The text after on is the operating system. Microsoft notes that it comes from the host, virtual machine or container, and does not always match the retail name of the OS.
@@VERSION works on every supported version, and on Azure SQL Database too. There the edition reads "Microsoft SQL Azure", and the version number is not comparable with SQL Server's: Microsoft's documentation points out that version 12 of Azure SQL Database is newer than version 16 of SQL Server.
SERVERPROPERTY: SQL Server version, edition and CU level as separate columns
@@VERSION returns one long string. For scripts, use SERVERPROPERTY, which returns each value on its own. Microsoft recommends it over parsing the @@VERSION text. Any user can query server properties; no special permission is needed.
SELECT
SERVERPROPERTY('ProductVersion') AS ProductVersion,
SERVERPROPERTY('ProductLevel') AS ProductLevel,
SERVERPROPERTY('ProductUpdateLevel') AS UpdateLevel,
SERVERPROPERTY('ProductUpdateReference') AS KB,
SERVERPROPERTY('Edition') AS Edition,
SERVERPROPERTY('EngineEdition') AS EngineEdition,
SERVERPROPERTY('ServerName') AS ServerName;
| Property | What it returns | Example |
|---|---|---|
ProductVersion | Full version, major.minor.build.revision | 16.0.4135.4 |
ProductMajorVersion | Major version only | 16 |
ProductBuild | Build number only (SQL Server 2014 and later) | 4135 |
ProductLevel | RTM, a service pack (SPn) or a preview (CTPn) | RTM |
ProductUpdateLevel | Cumulative update level, or NULL if none | CU14 |
ProductUpdateReference | KB article for that release | KB5038325 |
ProductBuildType | GDR or OD for a special build, NULL otherwise | NULL |
Edition | Edition name, with "(64-bit)" on 64-bit builds | Developer Edition (64-bit) |
EngineEdition | Number for the engine family: 2 Standard, 3 Enterprise, 4 Express, 5 Azure SQL Database, 8 Azure SQL Managed Instance | 3 |
One detail catches people out. SQL Server 2017 and later are updated with cumulative updates rather than service packs (their build lists contain only CUs and GDRs), so ProductLevel says RTM even on a fully patched server. The CU number is in ProductUpdateLevel. If that column is NULL, no cumulative update is installed. EngineEdition 3 covers Enterprise, Developer and Evaluation together, so use Edition when you need the exact name.
How to check SQL Server version in SSMS
SQL Server Management Studio shows the server version in two places without any query:
- Object Explorer. Connect to the server. The top node shows the server name followed by the version number and your login in brackets, for example
MYSERVER (SQL Server 16.0.4135.4 - sa). - Server Properties. Right-click the server in Object Explorer and choose Properties. The General page lists Product (the edition), Operating System, Platform and Version (the build number).
Do not confuse this with Help, then About. That window shows the version of SSMS itself, which has been a separate download since SQL Server 2016 and says nothing about the server you are connected to.
How to check SQL Server version from the command line with sqlcmd
sqlcmd runs a query and prints the result, which is handy on a server with no GUI or over a remote session. -Q runs the query and exits; -S names the server.
:: Default instance on this machine, Windows authentication
sqlcmd -S localhost -E -Q "SELECT @@VERSION"
:: Named instance
sqlcmd -S localhost\SQLEXPRESS -E -Q "SELECT @@VERSION"
:: SQL authentication (you are prompted for the password)
sqlcmd -S 203.0.113.10 -U sa -Q "SELECT @@VERSION"
On the ODBC-based sqlcmd, -E (a trusted Windows connection) is the default when you give no user name. Newer versions are secure by default: the current ODBC sqlcmd treats encryption as mandatory (-Nm) unless you say otherwise. If the server uses a self-signed certificate, which is common on a fresh install, the connection fails until you add -C to trust the server certificate. Use -C only for servers you control. Microsoft also ships a Go-based sqlcmd that runs on Windows, macOS and Linux and accepts the same basic flags.
How to check SQL Server version with PowerShell
The Invoke-Sqlcmd cmdlet in Microsoft's SqlServer PowerShell module runs the same queries:
Install-Module SqlServer -Scope CurrentUser
Invoke-Sqlcmd -ServerInstance "localhost" -TrustServerCertificate -Query "SELECT SERVERPROPERTY('ProductVersion') AS Version, SERVERPROPERTY('ProductUpdateLevel') AS CU, SERVERPROPERTY('Edition') AS Edition"
For a named instance, use ComputerName\InstanceName. From version 22 of the module, connections are encrypted by default, so -TrustServerCertificate plays the same role as sqlcmd -C for a server with a self-signed certificate. To check several servers, pass a list to a loop and collect the results in one table.
Find the SQL Server version without logging in: error log and registry
The error log
Every time SQL Server starts, it writes the same version line that @@VERSION returns at the top of its error log. This works when the service will not start or you have no login. On Windows the log is at C:\Program Files\Microsoft SQL Server\MSSQL{nn}.<instance>\MSSQL\Log\ERRORLOG; older logs are kept as ERRORLOG.1, ERRORLOG.2 and so on. Open it in Notepad and read the first few lines.
The Windows registry
Each instance has a registry key named after its instance ID. Microsoft's file-locations documentation gives the pattern: MSSQL, then the major version number, then a period and the instance name. A default instance of SQL Server 2022 is MSSQL16.MSSQLSERVER. To list the instances and their IDs, run this in PowerShell:
Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL'
Then read the Setup subkey of the instance you want:
Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL16.MSSQLSERVER\Setup' |
Select-Object Edition, Version, PatchLevel
Microsoft documents PatchLevel (the build currently installed) and Version (usually the build originally installed) for the Setup keys of other SQL Server components, such as full-text search and Analysis Services. The Database Engine's Setup key uses the same value names, so read PatchLevel for the current build. The SQL Server Installation Center (Tools, then Installed SQL Server features discovery report) shows the same data for every instance on the machine in one page.
How to check SQL Server version on Linux
SQL Server 2017 and later also run on Linux. Microsoft's Linux setup guide checks the version with sqlcmd -S localhost -U sa -Q 'select @@VERSION'. Microsoft's Ubuntu quickstart installs sqlcmd with the mssql-tools18 package in /opt/mssql-tools18/bin, so if that folder is not on your PATH, give the full path:
/opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -Q 'SELECT @@VERSION'
Newer versions of sqlcmd encrypt connections by default. If the connection fails, the quickstart suggests adding -No to make encryption optional; on a server with a self-signed certificate you can instead add -C to trust it, as on Windows.
On Linux the last line of the output names the distribution, for example on Linux (Ubuntu 24.04.3 LTS) <X64>. Without logging in to SQL Server, you have three other options:
- Package version:
apt list --installed mssql-serveron Ubuntu, oryum info mssql-serveron Red Hat Enterprise Linux. Either command shows the installedmssql-serverpackage version. - Error log:
sudo head -n 5 /var/opt/mssql/log/errorlog./var/opt/mssql/logis the default log directory unless it was changed withmssql-conf. - Service status:
systemctl status mssql-server --no-pagertells you whether the service is running, which is worth knowing before you try to connect.
To find the Linux distribution itself, see our guide on how to check the Ubuntu version. Which SQL Server versions a distribution supports depends on both: SQL Server 2025 supports Ubuntu 22.04 and 24.04 and Red Hat Enterprise Linux 9 and 10, but not SUSE.
SQL Server version numbers: map a build to its version and CU
The first number of the build tells you the product. The rest tells you the update. Microsoft keeps one build-versions page per product, listing every cumulative update and GDR security release with its build number and KB article. Its Latest updates and version history for SQL Server page links to them all.
| Product | Build starts with | Instance ID / folder | Latest listed build |
|---|---|---|---|
| SQL Server 2025 | 17.0 | MSSQL17 | 17.0.5065.9 (CU11) |
| SQL Server 2022 | 16.0 | MSSQL16 | 16.0.4325.4 (CU28) |
| SQL Server 2019 | 15.0 | MSSQL15 | 15.0.4510.2 (CU32 + GDR) |
| SQL Server 2017 | 14.0 | MSSQL14 | 14.0.3570.2 (CU31 + GDR) |
| SQL Server 2016 | 13.0 | MSSQL13 | 13.0.7095.1 (SP3 Azure Connect feature pack + GDR) |
| SQL Server 2014 | 12.0 | MSSQL12 | 12.0.6449.1 (SP3 CU4 + GDR) |
| SQL Server 2012 | 11.0 | MSSQL11 | 11.0.7512.11 (SP4 GDR) |
| SQL Server 2008 R2 | 10.50 | MSSQL10_50 | 10.50.6785.2 (SP3 GDR) |
| SQL Server 2008 | 10.0 | MSSQL10 | 10.0.6814.4 (SP4 GDR) |
The original release builds are a useful reference point too: SQL Server 2025 RTM is 17.0.1000.7, SQL Server 2022 RTM is 16.0.1000.6 and SQL Server 2019 RTM is 15.0.2000.5. If your build is close to one of these, the server has no cumulative update installed. It may still have security-only GDR updates, so look the build up on the list.
To map a build exactly:
- Run
SELECT SERVERPROPERTY('ProductVersion');and note the result, for example 16.0.4135.4. - The major number, 16, tells you which build-versions page to open: SQL Server 2022.
- Search that page for the full build. The row gives the CU name, the KB article and the release date.
- Compare it with the newest row on the same page to see how many updates behind you are.
Two kinds of update appear in those lists. A cumulative update (CU) includes fixes and improvements and moves the build forward. A GDR is a security-only release; it appears either on its own or as "CU + GDR" when it sits on top of a cumulative update. Do not compare builds by size alone: security-only GDR releases for unpatched RTM servers keep a low build number (SQL Server 2022's November 2026 GDR is 16.0.1220.3), so always look the build up on the list.
Which SQL Server edition do I have?
The edition decides what you are licensed to run and which limits apply. Read it from the end of the @@VERSION line, or from SERVERPROPERTY('Edition'). Common values are Enterprise, Standard, Web, Developer, Express and Evaluation. Microsoft lists Evaluation, Developer and Express as the freely licensed editions; the others need a paid licence. From SQL Server 2025, Developer is split into Enterprise Developer and Standard Developer. On Linux you choose the edition when you run mssql-conf setup, and you can change it later with mssql-conf set-edition.
Running SQL Server on a VPS or dedicated server
Knowing the exact version and edition matters most before an upgrade, a migration or a support call, so note it down for every server you manage. SQL Server is licensed separately from Windows Server, so tell your host which edition you will run. On Linux, Microsoft lists 2 GB of memory as the minimum to start SQL Server, and in practice a production database wants a good deal more.
This guide was written by the Bigdomainhost team with AI assistance; queries and commands were checked against the Microsoft Learn and Microsoft Support pages linked below on 25 November 2026.
Sources (checked )
- Microsoft Learn: Find the version and edition of your SQL Server Database Engine (KB321185)
- Microsoft Learn: @@VERSION (Transact-SQL)
- Microsoft Learn: SERVERPROPERTY (Transact-SQL)
- Microsoft Learn: Server Properties (General page) in SSMS
- Microsoft Learn: Determine version information of SQL Server components and client tools
- Microsoft Learn: sqlcmd utility
- Microsoft Learn: Invoke-Sqlcmd (SqlServer module)
- Microsoft Learn: File locations for default and named instances of SQL Server
- Microsoft Learn: Installation guidance for SQL Server on Linux (check installed version)
- Microsoft Learn: Install the sqlcmd and bcp command-line tools on Linux
- Microsoft Learn: Quickstart: Install SQL Server on Ubuntu
- Microsoft Learn: Configure SQL Server on Linux with mssql-conf (error log location)
- Microsoft Support: Latest updates and version history for SQL Server
- Microsoft Support: SQL Server 2025 build versions (KB5005684)
- Microsoft Support: SQL Server 2022 build versions (KB5023451)
- Microsoft Support: SQL Server 2019 build versions (KB4518398)