SQL tricks
September 1, 2022
How to check MS SQL Server version?
Question: What are the possible ways to determine the deployed SQL Server version?
Solution: Connect to the instance of SQL Server, and then run the following query:
-- Method 1 SELECT @@version; -- Method 2 SELECT SERVERPROPERTY('productversion') productversion, SERVERPROPERTY ('productlevel') productlevel, SERVERPROPERTY ('edition') edition; -- Method 3 SELECT SERVERPROPERTY('ProductVersion') AS ProductVersion, CAST(SERVERPROPERTY('ProductMajorVersion') AS INT) AS ProductMajorVersion, CAST(SERVERPROPERTY ('ProductMinorVersion') AS INT) AS ProductMinorVersion;
MS SQL Fiddle: https://sqlize.online/sql/mssql2017/3a50befcd7753aad09423d250c00ffff/