SELECT B.value FROM ( SELECT [value] = CONVERT(xml,'<root><v>' + REPLACE('A,C,D', ',', '</v><v>') + '</v></root>') ) A OUTER APPLY ( SELECT value = N.v.value('.', 'varchar(100)') FROM A.[value].nodes('/root/v') N(v) ) B
结果:
A
C
D
SELECT B.value FROM ( SELECT [value] = CONVERT(xml,'<root><v>' + REPLACE('A,C,D', ',', '</v><v>') + '</v></root>') ) A OUTER APPLY ( SELECT value = N.v.value('.', 'varchar(100)') FROM A.[value].nodes('/root/v') N(v) ) B
结果:
A
C
D