create table tb(name varchar(1))
insert into tb values('a')
insert into tb values('b')
insert into tb values('c')
go


--方法一
declare @sql varchar(1000)
set @sql = ''
select @sql = @sql + t.name from (select name from tb) as t
set @sql='select result = ''' + @sql + ''''
exec(@sql)
/*
result
------
abc
*/

--方法二
declare @output varchar(8000)
select @output = coalesce(@output , '') + name from tb
print @output
/*
abc
*/

drop table tb