--分割符转列
select
ParsedData.
*
from
new_systemparameterbase mt
cross apply ( selectstr= mt.New_value +‘,,‘ ) f1
cross apply ( select p1 =charindex( ‘,‘, str ) ) ap1
cross apply ( select p2 =charindex( ‘,‘, str, p1 +1 ) ) ap2
cross apply ( select p3 =charindex( ‘,‘, str, p2 +1 ) ) ap3
cross apply ( select p4 =charindex( ‘,‘, str, p3 +1 ) ) ap4
cross apply ( select p5 =charindex( ‘,‘, str, p4 +1 ) ) ap5
cross apply ( select p6 =charindex( ‘,‘, str, p5 +1 ) ) ap6
cross apply (
selectsubstring( str, 1, p1-1 ) a1
, substring( str, p1+1, p2-p1-1 ) a2
, substring( str, p2+1, p3-p2-1 ) a3
, substring( str, p3+1, p4-p3-1 ) a4
, substring( str, p4+1, p5-p4-1 ) a5
, substring( str, p5+1, p6-p5-1 ) a6
) ParsedData
where mt.new_name =‘detectionorderproductwarehouseaddress‘
原文:https://www.cnblogs.com/zengtianli/p/12172744.html
【说明】:本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!