Viewing 2 posts - 1 through 3 (of 3 total)
we can do this with COALESCE function also
DECLARE @DBs TABLE ( DBname NVARCHAR(100) )
DECLARE @txt varchar(50)
INSERT INTO @DBs
VALUES ( 'A' ),
( 'B' ),
( 'C' )
select @txt=COALESCE(@txt+',','')+DBname from @DBs
select @txt
June 24, 2016 at 2:06 am
#1886664
...
June 24, 2016 at 2:01 am
#1886663