JSON_ARRAYAGG() in SQL Server 2025: Aggregate Rows Into JSON Arrays

JSON_ARRAYAGG() is one of the new features introduced in SQL Server 2025. This is an aggregation function that allows you to combine multiple row values into a single JSON array directly within your SQL queries.

JSON_ARRAYAGG() simplifies the process of generating structured JSON output from relational data, which makes it easier to build APIs, export data, and integrate with modern applications that rely on JSON. Instead of manually constructing JSON with string operations or complex subqueries, JSON_ARRAYAGG() provides a clean, efficient way to transform sets of rows into well-formed JSON arrays as part of standard SQL aggregation.

Read more

What is a Data Mesh?

Data mesh is one of the newer ideas in the data world. And it’s generated a lot of confusion. Unlike data lakes or data warehouses, it’s not a technology you buy or install. Rather, it’s a way of organizing how your company thinks about and manages data.

Read more

Data Governance Explained

Data governance isn’t the most exciting term in the data world, but it might be one of the most important. Companies that ignore it tend to find out why it matters the hard way. Often this is through a compliance failure, a data breach, or a boardroom argument about whose numbers are right.

Read more

Fix “JSON aggregates do not support order-by within group when specified with grouping sets, cubes and rollups” in SQL Server

If you’re getting an error that reads “JSON aggregates do not support order-by within group when specified with grouping sets, cubes and rollups. Try your query without order-by within group.” it looks like you’re trying to use the ORDER BY clause inside a JSON aggregate function when using GROUPING SETS, CUBE, or ROLLUP.

To fix this error you’ll need to remove ORDER BY from the aggregate function when using those clauses.

Read more

Column-Level Security Explained

You may be aware of a concept called row-level security, which controls which rows a user can see in a table. Column-level security is a similar concept, controls which columns are visible. It solves a different problem. Same table, same rows, but some fields in those rows shouldn’t be visible to everyone.

Think about an employees table. A manager might reasonably see a list of all staff and their departments. But salary? National ID numbers? Personal contact details? These should be visible to the manager, but they probably shouldn’t be visible to most other employees, even if they’re querying the same table.

Read more

Fix Error 8110 “Cannot add multiple PRIMARY KEY constraints to table” in SQL Server

If you’re getting SQL Server error 8110 that reads “Cannot add multiple PRIMARY KEY constraints to table…” it’s because you’re trying to add more than one primary key to a table. In SQL Server, a table cannot contain more than one primary key.

It’s quite possible you were trying to create a composite primary key, and so you might need to fix your syntax. If that’s the case, read on.

Read more