There are several ways to concatenate row values into a single string in SQL Server, including using custom SQL functions, COALESCE, or the FOR XML PATH clause. In this post, I will demonstrate how to perform string aggregation using XML PATH and COALESCE. To make these examples easy to follow, I'll be using the NORTHWND sample database to show these methods in action.
Using COALESCE function , we can concatenate many row values in to one single string. this is one use of COALESCE , there are many ,so you can find some more clicking above mention link.
1

2

To ensure our final string doesn't start with an extra comma, we use the
STUFF function. STUFF works by deleting a specific portion of a string and replacing it with another. In this case, we use it to target the very first character—the extra comma—and replace it with nothing, effectively removing it from the beginning of our result.