Tuesday, October 31, 2017

How do you use the STRING_AGG() function?

You can create comma separated, concatenated strings from values in columns in a database. The concatenated strings are separated by a separator which gets added except for the end of the string.

The full syntax is here:

STRING_AGG ( expression, separator ) [ ]

::=  
    WITHIN GROUP ( ORDER BY [ ASC | DESC ] ) 


If you have SQL Server 2016, this will not work as shown here.


But it does recognize it as a function because I am using SQL Server Management Studio v17


Why not download SQL Server 2017 RC2 and try?

No comments: