;WITH CTETest AS( SELECT CONVERT(XML,'<V><V1><V3>'+ REPLACE(REPLACE(Company,'#','</V3></V1><V2><V3>'),',','</V3><V3>') +'</V3></V2></V>')V FROM Test WHERE id=001),T1 AS( SELECT ROW_NUMBER()OVER(ORDER BY GETDATE())RN,V1 FROM (SELECT V.query('//V1')V FROM CTETest)A OUTER APPLY(SELECT N.v.value('.','NVARCHAR(100)')V1 FROM A.V.nodes('//V3')N(V))B),T2 AS( SELECT ROW_NUMBER()OVER(ORDER BY GETDATE())RN,V2 FROM (SELECT V.query('//V2')V FROM CTETest)A OUTER APPLY(SELECT N.v.value('.','NVARCHAR(100)')V2 FROM A.V.nodes('//V3')N(V))B)SELECT V1,V2 FROM T1 FULL JOIN T2 ON T1.RN=T2.RN