Other day I made a post on how to concatenate a rowset into a TSQL variable: here
In this post I’ll show how to make a concat into a column without using any variable:
select (
select Col + ', '
from ( select 'Value 1' Col union select 'Value 2' union select 'Value 3' ) aux FOR XML PATH('')
) ConcatColumn
The trick is on "FOR XML PATH("")" that transform the rows into a xml string where the node name is passed by parameter, in this case I pass an empty string, so the result is: