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_listFROM sys.columns AS cGROUP BY c.object_id;
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];
1 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.
Please sign in to leave a comment.
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: