STUFF vs COALESCE in TSQL for Concatenating row values

Aram Koukia
Koukia
Published in
1 min readDec 8, 2016

--

Say you have a result set that looks like the following table:

Now what you want is, to have the result set to look like below:

In the old days of SQL Server 7.0 and SQL Server 2000, I Used to do this with a variable and using COALESCE like the following:

--

--

Software Engineer, Engineering Leader and Manager @ AWS. Living my dream life. http://koukia.ca/