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

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s