I'm using SQL Prompt 11.0.8 on Azure SQL database, using an example from Microsoft's JSON_ARRAYAGG documentation:

SELECT TOP(5) c.object_id, JSON_ARRAYAGG(c.name ORDER BY c.column_id) AS column_list
FROM sys.columns AS c
GROUP BY c.object_id;

When formatting the code I get the following error:

When removing the ORDER BY it puts JSON_ARRAYAGG in square brackets, which can't be executed:

SELECT TOP (5)
      [c].[object_id]
    , [JSON_ARRAYAGG] ([c].[name]) AS [column_list]
FROM [sys].[columns] AS [c]
GROUP BY [c].[object_id];
Chris
0

Comments

2 comments

  • Ben Patel
    Official comment

    Thank you for your post. I've replicated the same behaviour locally and can see the examples in the Microsoft docs, so I'll pass this on to the developers for a fix. 

    Ben Patel
  • Christian Perez

    Latest version of SQL Prompt now has the fix for this behavior. We kindly ask that you please upgrade to the latest version and let us know if you are still experiencing this issue.

    Christian Perez
    0

Add comment

Please sign in to leave a comment.