在SQL中怎么把一列字符串拆分为多列

--首先,你是按什么规则拆? 我举个例子 你要按字段中的逗号拆开,假设字段名叫text

--用charindex和substring这2个函数   
select substring(text,1,charindex(',',text)-1) as [before]
,substring(text,charindex(',',text),len(text)) as [after]
from table

  

原文地址:https://www.cnblogs.com/xubao/p/11008158.html