declare @v varchar(max) = '1,11,111,1111'
I need output like this (in separate lines):
1
11
111
1111
I am able to get the first and the last using:
select Substring(@v,0,CharIndex(',',@v))
select substring(@v, CHARINDEX(',', @v, CHARINDEX(',', @v, CHARINDEX(',', @v)+1)+1)+1, len(@v))
But, how can I get the second and third substrings separately?