Azure SQL Database – Greatest and Least TSQL

Being in the cloud does have many benefits, from lower administration to fast scaling but another “side effect” of operating in Azure SQL Database is the cloud first nature of changes. By this I basically mean new features always get pushed to Azure first before the classic on-premises version so some gems come to light.

Here is one for you. Have you ever wanted MySQL’s functinality to apply LEAST() and GREATEST() argument? Well, you can now, in Azure.

Check my build number / date, did something happen in October?

SELECT @@VERSION

Let’s run the below:

SELECT GREATEST (3,2,1) AS [Highest Num]
SELECT LEAST (1,2,3) AS [Lowest Num]

Well, what a nice surprise, Christmas has come early.

3 thoughts on “Azure SQL Database – Greatest and Least TSQL

  1. Pingback: Azure SQL Database – Greatest and Least TSQL from Blog Posts - SQLServerCentral - Actu Tech

  2. Pingback: GREATEST and LEAST in Azure SQL Database – Curated SQL

  3. Pingback: Dew Drop – November 27, 2020 (#3327) | Morning Dew

Leave a Reply