Use string_split()
:
select t.ticket, s.value as agent
from t cross apply
string_split(t.agent, '
') s
order by s.value;
Here is a db<>fiddle.
solved separate values by new line and split to new row [duplicate]
Use string_split()
:
select t.ticket, s.value as agent
from t cross apply
string_split(t.agent, '
') s
order by s.value;
Here is a db<>fiddle.
solved separate values by new line and split to new row [duplicate]