-- 插入数据
insert into dbo.tb_hobby values ('1001','朱梅拉','跑步,踢足球,打篮球');
insert into dbo.tb_hobby values ('1002','李格策','书法,跑步');
-- 查询
select * from dbo.tb_hobby;
-- 拆分成行
select a.id
,a.name
,SUBSTRING(a.hobby,number,CHARINDEX(',',a.hobby+',',number)-number) as hobby
from tb_hobby a,master..spt_values
where number >= 1 and number < len(a.hobby)
and type='p'
and SUBSTRING(','+a.hobby,number,1)=','
insert into dbo.test_name values ('1','张三','电脑,电视机,扫地机');
insert into dbo.test_name values ('2','李四',.
select substring(TEST_COL+',',number,charindex(',',TEST_COL+',',number)-number)
from TEST_TABLE ,master..spt_values s
where type='p' and number>0 and substring(','+TEST_COL,number,1)=','