STRING_AGG – A New function in SQL Server 2017

STRING_AGG is an interesting aggregated function. It concatenates the values of string expressions and places separator values between them. And what more? The separator is not added at the end of string. Yeah!

This will produce following result:

You can also use CHAR() function to add any printable or non-printable character you want as separator.

It’s important to note that STRING_AGG ignore NULL values.



You may also like...