I thought you would need to do "@subject +=" rather than "@subject = +". In any case, the += operator is supported only in SQL 2008 or later. If that indeed is the objective you should change it. The other alternatives are 1 and 3 in the example code below. CREATE TABLE #tmp(a VARCHAR(32));
INSERT INTO #tmp VALUES ('abc'),('def');
DECLARE @x VARCHAR(32) = '',
@y VARCHAR(32) = '',
@z VARCHAR(32) = ''
-- 1
SELECT @x = @x + a FROM #tmp;
-- 2
SELECT @y += a FROM #tmp;
-- 3
SELECT @z = (SELECT a AS [text()] FROM #tmp FOR XML PATH(''));
SELECT @x,@y,@z;
DROP TABLE #tmp;