Одним из методов является рекурсивный CTE.Мне немного непонятно, как называются имена столбцов, поэтому я сделал их общими:
with cte as (
select left(col1, charindex(',', col1) - 1) as col1,
left(col2, charindex(',', col2) - 1) as col2,
col3, col4,
stuff(col1, 1, charindex(',', col1), '') as col1_rest,
stuff(col2, 1, charindex(',', col2), '') as col2_rest
from t
union all
select left(col1_rest, charindex(',', col1_rest + ',') - 1) as col1,
left(col2_rest, charindex(',', col2_rest + ',') - 1) as col2,
col3, col4,
stuff(col1_rest, 1, charindex(',', col1_rest + ','), '') as col1_rest,
stuff(col2_rest, 1, charindex(',', col2_rest + ','), '') as col2_rest
from cte
where col1_rest > ''
)
select col1, col2, col3, col4
from cte;
Здесь - это скрипта db <>.