I have successfully divided the Strings from column Alt#LampPartNumber into columns second_Main1 and Second_Main2 and so on...now have to split the String from column LampPart Number in new lines with the same Second_Main1 and Second_Main2 each.
(Select distinct [ID], [LampPart Number], Value,
row_number() over(partition by [ID] order by [ID]) as RowNumber
from [dbo].[test$]
cross apply
String_Split(Replace([Alt# LampPart Number], ' / ','|'),'|')
)
Select distinct [ID],[LampPart Number],
[1] as Second_Main1, [2] as Second_Main2,[3] as Second_Main3,[4] as Second_Main4
from Alt#LampPartNumber_CTE
pivot
(max(value)
for RowNumber in ([1],[2],[3],[4],[5])) as PVT ```