STRING_AGG is not a recognized built-in function name

Luke101 picture Luke101 · Dec 2, 2016 · Viewed 55.7k times · Source

I've downloaded and installed SQL Server 2016. When I attempted to use the STRING_AGG function I receive this error. Here is my code:

SELECT STRING_AGG(cast(FieldNumber AS VARCHAR(100)), ',')
FROM Fields

I've installed SQL Server 2016 and SP1. Is there anything else I need to do. Here is the feature I am trying to use. String Agg

Answer

Pரதீப் picture Pரதீப் · Dec 2, 2016

STRING_AGG is not introduced in SQL SERVER 2016.

It is introduced in SQL SERVER vNext. In the MSDN link you have provided it is mentioned THIS TOPIC APPLIES TO : SQL Server (starting with vNext) not SQL SERVER 2016. It is a much needed feature I wish they add it in any future releases

In case you are wondering what is vNext

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

For more info check here