DECLARE @ids VARCHAR(2200) ='a,c,d,e,f,g' SELECT c.value('.','varchar(50)') AS id FROM ( SELECT CAST('<r>' + REPLACE(@ids,',', '</r><r>') + '</r>' AS XML) AS value ) tb CROSS APPLY tb.value.nodes('*') t (c)
标签:xml,转行,ids,value,sql,tb,SELECT From: https://www.cnblogs.com/zengtianli/p/16738925.html