I have a column of nvarchar(255)
type that represents software version
numbers:
VersionNumber
---------------
1.0.0.505
1.0.0.506
1.0.0.507
1.0.0.508
1.0.0.509
1.0.1.2
I need to extract the maximum version number (the min version number in the example above is 1.0.0.505 and the max version number is 1.0.1.2, values arranged from the smallest to the highest).
in order to explain exactly what i need - if i could use imperative programming language i think i would do something like that to detect the max version number:
- lets say version number is d.c.b.a.
- i would separate each version number to four different variables: a b c d
- that i will sum each series.
- a will be summed by tens
- b will be summed by hundreds
- c will be summed by thousands
- d will be summed by milions
than the maximum total sum of each Max(a+b+c+d) will be the max version.
but what is the technic to achieve something like that in sql?