Version number sorting in Sql Server

前端 未结 7 1193
说谎
说谎 2021-01-13 05:35

I have a table that stores the versions as under

Declare @tblVersion table(VersionNumber varchar(100))
 Insert into @tblVersion Values(\'1.3.1\')
 Insert int         


        
7条回答
  •  半阙折子戏
    2021-01-13 06:20

    I cannot see the solution using standard sorting etc, but I think you need the UDF that adds the "0" symbols before each symbol, like

    001.003.001
    001.003.002.005
    001.004.001.007.012
    001.004.011.014.007
    001.004.003.109.001
    001.004.008.066
    

    and then sort by these changed values

提交回复
热议问题