Search code examples
hanasap-cloud-platform

Check HANA edition with SQL?


I have a JDBC connection to a SAP HANA database and I want to query whether it's a SAP HANA Cloud db or not. I know I can find the version with:

SELECT VERSION FROM SYS.M_DATABASE;

and this gives me 4.00.000.00.1608802791 for the cloud and 2.xx for my on-premise Dockerised version, but to avoid hard-coding version numbers everywhere, is there an equivalent query to, say, SQL Server's SELECT SERVERPROPERTY('edition')?


Solution

  • You could use SELECT VALUE FROM M_HOST_INFORMATION WHERE KEY='build_branch'

    • On premise: fa/hana2sp05
    • In the cloud: fa/CE2020.36

    You might also like M_SYSTEM_OVERVIEW, it has interestign informations such as the server start time.