Sql一行拆分转多行

select   
    a.planid,b.mias,0 miaid  into [1_cache3]
from   
    (select planid,mias=convert(xml,''+replace(mias,',','')+'') from [1_cache1])a  
outer apply  
    (select mias=C.v.value('.','nvarchar(100)') from a.mias.nodes('/root/v')C(v))b  order by  a.planid

代码就这么简单,备忘

转载于:https://www.cnblogs.com/bfyx/p/6774501.html

你可能感兴趣的