parse_version()
Applies to: ✅ Azure Data Explorer ✅ Azure Monitor ✅ Microsoft Sentinel
Converts the input string representation of the version to a comparable decimal number.
Syntax
parse_version
(
version)
Learn more about syntax conventions.
Parameters
Name | Type | Required | Description |
---|---|---|---|
version | string |
✔️ | The version to be parsed. |
Note
- version must contain from one to four version parts, represented as numbers and separated with dots ('.').
- Each part of version may contain up to eight digits, with the max value at 99999999.
- If the number of parts is less than four, all the missing parts are considered as trailing. For example,
1.0
==1.0.0.0
.
Returns
If conversion is successful, the result will be a decimal.
If conversion is unsuccessful, the result will be null
.
Example
let dt = datatable(v: string)
[
"0.0.0.5", "0.0.7.0", "0.0.3", "0.2", "0.1.2.0", "1.2.3.4", "1", "99999999.0.0.0"
];
dt
| project v1=v, _key=1
| join kind=inner (dt | project v2=v, _key = 1) on _key
| where v1 != v2
| summarize v1 = max(v1), v2 = min(v2) by (hash(v1) + hash(v2)) // removing duplications
| project v1, v2, higher_version = iif(parse_version(v1) > parse_version(v2), v1, v2)
Output
v1 | v2 | higher_version |
---|---|---|
99999999.0.0.0 | 0.0.0.5 | 99999999.0.0.0 |
1 | 0.0.0.5 | 1 |
1.2.3.4 | 0.0.0.5 | 1.2.3.4 |
0.1.2.0 | 0.0.0.5 | 0.1.2.0 |
0.2 | 0.0.0.5 | 0.2 |
0.0.3 | 0.0.0.5 | 0.0.3 |
0.0.7.0 | 0.0.0.5 | 0.0.7.0 |
99999999.0.0.0 | 0.0.7.0 | 99999999.0.0.0 |
1 | 0.0.7.0 | 1 |
1.2.3.4 | 0.0.7.0 | 1.2.3.4 |
0.1.2.0 | 0.0.7.0 | 0.1.2.0 |
0.2 | 0.0.7.0 | 0.2 |
0.0.7.0 | 0.0.3 | 0.0.7.0 |
99999999.0.0.0 | 0.0.3 | 99999999.0.0.0 |
1 | 0.0.3 | 1 |
1.2.3.4 | 0.0.3 | 1.2.3.4 |
0.1.2.0 | 0.0.3 | 0.1.2.0 |
0.2 | 0.0.3 | 0.2 |
99999999.0.0.0 | 0.2 | 99999999.0.0.0 |
1 | 0.2 | 1 |
1.2.3.4 | 0.2 | 1.2.3.4 |
0.2 | 0.1.2.0 | 0.2 |
99999999.0.0.0 | 0.1.2.0 | 99999999.0.0.0 |
1 | 0.1.2.0 | 1 |
1.2.3.4 | 0.1.2.0 | 1.2.3.4 |
99999999.0.0.0 | 1.2.3.4 | 99999999.0.0.0 |
1.2.3.4 | 1 | 1.2.3.4 |
99999999.0.0.0 | 1 | 99999999.0.0.0 |