STRING_AGG is not a recognized built-in function name
STRING_AGG
is not introduced in SQL SERVER 2016
.
It is introduced in SQL SERVER 2017
. In the MSDN link you have provided it is mentioned THIS TOPIC APPLIES TO : SQL Server 2017 not SQL SERVER 2016
.
At the time of the question, this version was known by the code name "vNext", described as:
SQL Server vNext represents a major step towards making SQL Server a platform that enables choices of development languages, data types, on-premises and in the cloud, and across operating systems by bringing the power of SQL Server to Linux, Linux-based Docker containers, and Windows. SQL Server vNext also includes the features added in SQL Server 2016 service packs