MATCH_NUMBER
MATCH_NUMBER is a value from the Ranking window functions in SQL Server. It provides a unique row number for each row regardless of duplicates within a partition. It's calculated for the result set partition, ordered by the defined ORDER BY clause in the ranking function.
Example
Output
Explanation
In this example, the MATCH_NUMBER
function is used to provide a unique number for each match generated by a pattern within a MATCH_RECOGNIZE
clause. As the MATCH_RECOGNIZE clause is not used in this query, default match number returned is 1.