日期:2014-05-17 浏览次数:20492 次
declcare @names
select @names=XXX from table
最后得到的是 @name=小明,小张……
create table #tb (col varchar(800))
insert into #tb
select '北京' union all
select '上海' union all
select '杭州'
select STUFF( (select ','+COL from #tb for xml PATH ('')),1,1,'')
drop table #tb