Since Microsoft introduced XML support in SQL Server, the most common string concatenation technique was use of “XML PATH(”)” like this:SELECT SUBSTRING(
(SELECT ‘, ‘ + name FROM master.sys.tables
FOR XML PATH(”))
Now you can aggregate your strings by using function “STRING_AGG”:SELECT STRING_AGG(name, ‘, ‘) FROM master.sys.tables;
Read on for the other three. This aggregation function, however, would make some of my code a lot simpler and easier to explain to junior database developers. I just want it to perform well is all.