逻辑:先将该字段值统一替换为符号(我用的符号是“я”) 分割,再将符号分割替换转为XML数据类型,再利用xml转为多个行
拆分前
select ptypeid,serial from salebill
拆分后
select ptypeid,serial
from ( select ptypeid, convert(xml, '<n>' + replace(replace(Serial, 'я', 'я'), 'я', '</n><n>') + '</n>') as xmlval1
from salebill ) a
cross apply ( select k.n.value('.', 'nvarchar(800)') serial
from a.xmlval1.nodes('n') k(n) ) bs
标签:多行,xml,Server,ptypeid,拆分,SQL,salebill,replace,select From: https://www.cnblogs.com/mojito/p/16983471.html