Skip to main content
2 of 2
added 110 characters in body
Ergest Basha
  • 5.4k
  • 3
  • 8
  • 22

One option could be EngineEdition .

Try:

SELECT CASE ServerProperty('EngineEdition') WHEN 1 THEN 'Personal' WHEN 2 THEN 'Standard' WHEN 3 THEN 'Enterprise' WHEN 4 THEN 'Express' WHEN 5 THEN 'SQL Database' WHEN 6 THEN 'Azure Synapse Analytics' WHEN 8 THEN 'Azure SQL Managed Instance' WHEN 9 THEN 'Azure SQL Edge' WHEN 11 THEN 'Azure Synapse serverless SQL pool' END 

Note. There are different ways of getting the SQL Server version on the link above using SERVERPROPERTY.

Another simpler method:

SELECT CASE WHEN ServerProperty('Edition') = 'SQL Azure' THEN 'Azure' ELSE 'No Azure' END AS server_version; 

https://dbfiddle.uk/?rdbms=sqlserver_2019&fiddle=c10db6e4d5def947657b780ede48fee1

Ergest Basha
  • 5.4k
  • 3
  • 8
  • 22