String Aggregation Over the Years in SQL Server
SQL Performance
FEBRUARY 17, 2022
Since SQL Server 2005, the trick of using FOR XML PATH to denormalize strings and combine them into a single (usually comma-separated) list has been very popular. On more than one occasion, I had to double-check the code was even mine. The most fatal flaw in the code above is it leaves a trailing comma: UserID Bands.
Let's personalize your content