如:aa|bb,如果aa和bb是不定长的用如下语句分割他们
select x.fa,x.fb,x.fc ,x.fd ,substring(x.fd,1,(select charindex('|',y.fd) from t1 y where x.fa=y.fa and x.fb=y.fb and x.fc=y.fc)-1)
from t1 x
博客给出了SQL中不定长字符分割的语句示例。对于如aa|bb这种不定长字符,使用特定的select语句进行分割,通过substring和charindex函数实现,涉及表t1的字段操作。
如:aa|bb,如果aa和bb是不定长的用如下语句分割他们
select x.fa,x.fb,x.fc ,x.fd ,substring(x.fd,1,(select charindex('|',y.fd) from t1 y where x.fa=y.fa and x.fb=y.fb and x.fc=y.fc)-1)
from t1 x

被折叠的 条评论
为什么被折叠?