SQL SERVER 中将数据表中的字段按分隔符分成多行多列_sql按逗号拆分列为多行_帅气的苹果果的博客-CSDN博客
SELECT
a.name,
'monitors' = SUBSTRING ( a.monitors, b.number, charindex( ',', a.monitors+ ',', b.number ) - b.number )
FROM
( SELECT name, monitors FROM [dbo].[ssm_video_zhi_li] WHERE type = '小区村居' ) a
INNER JOIN master.dbo.spt_values b ON b.number BETWEEN 1
AND len( a.monitors )
AND SUBSTRING ( ',' + a.monitors, b.number, 1 ) = ','
WHERE
b.type= 'P'