Scripts

Technical Article

T-SQL Table Valued Function to compare Semantic Versions

Semantic versioning (SemVer) is a standardized system for labeling software releases using a three-part number—major, minor, and patch—optionally followed by pre-release labels and build metadata. Comparing semantic versions is complex because it requires handling both numeric and string components, as well as special precedence rules for pre-releases and stable versions. SQL Server’s hierarchyid data type is ideally suited for comparing the numeric parts of semantic versions, enabling efficient and accurate ordering without the pitfalls of string comparison or manual parsing.

5 (1)

You rated this post out of 5. Change rating

2025-05-27

74 reads

Blogs

ADF: Publish suddenly includes everything where it used to be incremental changes since the last publish

By

I recently encountered an interesting issue with ADF where the publish feature suddenly attempted...

Beginner’s Guide: Create a File Organizer CLI Tool in Rust

By

Image from Afdhaluddin on ShutterstockCLI which is generally referred to as Command Line Interface...

The Third Sabbatical

By

I can’t believe I’ve been at Redgate long enough to get a third sabbatical....

Read the latest Blogs

Forums

How Many Can Be the Greatest

By Steve Jones - SSC Editor

Comments posted to this topic are about the item How Many Can Be the...

Azure Database Watcher Monitoring

By bokswager

Hi, I’ve provisioned an Azure Database Watcher to monitor our 4 Azure SQL Managed...

Can You Ask for a Raise?

By Steve Jones - SSC Editor

Comments posted to this topic are about the item Can You Ask for a...

Visit the forum

Question of the Day

How Many Can Be the Greatest

I am trying to analyze a number of columns in a large table to determine the highest value for each row. In SQL Server 2022, we have the GREATEST function, which will return the greatest value from those columns passed in. How many columns can I include in an expression like this:

select GREATEST( col1, col2, col3, ...)

See possible answers