I have the column "structure" with string values like: (and that feed a .net treeview)
I need to get the upcoming number, remaining on the same level (1.3.3, 18.104.22.168, 1.12, 4)
The expression I found is really complicated for something that looks quite simple.
CAST(CASE WHEN CHARINDEX('.', structure) > 0 THEN substring(structure, len(structure) - CHARINDEX ( '.' ,REVERSE(structure))+2, CHARINDEX ( '.' ,REVERSE(structure))-1) ELSE structure END as int) +1
... and this is only the last number; now I should get the first part with the same strategy; so I thought somebody might have a smarter approach