Quantcast
Viewing all articles
Browse latest Browse all 193

how to sort version Number?

Hi All,

Can any one give me a sql statement for sorting version numbers.

when i used the below query

SELECT [Policy ID] FROM [ITPP] ORDER BY cast('/' + replace([Policy ID] , '.', '/') + '/' as varchar(max)) 

eg 

ITPP 1.0
ITPP 10.0
ITPP 11.0
ITPP 12.0
ITPP 13.0
ITPP 13.1
ITPP 13.2
ITPP 14.0
ITPP 15.0
ITPP 16.0
ITPP 17.0
ITPP 18.0
ITPP 19.0
ITPP 2.0
ITPP 20.0
ITPP 21.0
ITPP 22.0
ITPP 3.0
ITPP 4.0
ITPP 5.0
ITPP 6.0
ITPP 7.0
ITPP 8.0
ITPP 9.0

after ITPP 1.0 next value should be ITPP 2.0 instead ITPP 10.0 comes 


Viewing all articles
Browse latest Browse all 193

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>