It's not the first time that I stumble over this problem to order a list with this kind of entries (1,3.10.3,3.1.10,...) With the new SQL functions (2016) there must be smart way to do it?
IF OBJECT_ID('tempdb..#Temp') IS NOT NULL DROP TABLE #Temp CREATE TABLE #Temp (structure Nvarchar(20)) insert into #Temp select '1' union all select '3.10.3' union all select '3.1.10' union all select '10.0.1' union all select '4.11' union all select '184.108.40.206'
A good starting point seems to me this query, that splits the structure. The rest should be smart grouping... but I can't do it!
select a.*,row_number() over (partition by structure order by structure) as ord, value from #Temp a cross apply string_split(structure,'.') order by structure