create table #1
( a int, b varchar(10))insert into #1 values(1,'aa')
insert into #1 select 1,'1a' union allselect 2,'1b' union allselect 3,'1c' goselect * from #1declare @str varchar(8000)
declare @bb varchar(20)select @str= isnull(@str+',','')+bfrom #1 select @str