A few days ago i showed how to split string with XML.
Now it's time for concatenation with XML.
DECLARE @t TABLE (col VARCHAR(10))
INSERT into @t
select 'aaaa' UNION ALL
select 'bbbb' UNION ALL
select 'cccc' UNION ALL
select null UNION ALL
select 'dddd'
SELECT * FROM @t
SELECT
(
SELECT col + ', ' as [text()]
FROM @t
ORDER BY col DESC
FOR XML PATH('')
) AS MyCsvList
Both of these (split and concat) methods aren't really anything special. They're just a new way of solving old problem.
But whenever i need them i have to look them up, so where else to keep them handy than here, right? :)