Skip to content

Commit 6471b91

Browse files
authored
Merge pull request #36977 from MicrosoftDocs/FromPublicRepo
Confirm merge from FromPublicRepo to main to sync with https://github.com/MicrosoftDocs/sql-docs (branch live)
2 parents b92fbe2 + 1902746 commit 6471b91

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

docs/t-sql/functions/json-objectagg-transact-sql.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,16 @@ FROM sys.columns AS c
106106
GROUP BY c.object_id;
107107
```
108108

109+
[!INCLUDE [ssresult-md](../../includes/ssresult-md.md)]
110+
111+
| object_id | column_list |
112+
| --- | --- |
113+
| 3 | `{"bitpos":12,"cid":6,"colguid":13,"hbcolid":3,"maxinrowlen":8,"nullbit":11,"offset":10,"ordkey":7,"ordlock":14,"rcmodified":4,"rscolid":2,"rsid":1,"status":9,"ti":5}` |
114+
| 5 | `{"cmprlevel":9,"fgidfs":7,"fillfact":10,"idmajor":3,"idminor":4,"lockres":17,"maxint":13,"maxleaf":12,"maxnullbit":11,"minint":15,"minleaf":14,"numpart":5,"ownertype":2,"rcrows":8,"rowsetid":1,"rsguid":16,"scope_id":18,"status":6}` |
115+
| 6 | `{"cloneid":6,"dbfragid":8,"id":1,"partid":3,"rowsetid":7,"segid":5,"status":9,"subid":2,"version":4}` |
116+
| 7 | `{"auid":1,"fgid":5,"ownerid":3,"pcdata":10,"pcreserved":11,"pcused":9,"pgfirst":6,"pgfirstiam":8,"pgroot":7,"status":4,"type":2}` |
117+
| 8 | `{"fileid":2,"filename":4,"name":3,"status":1}` |
118+
109119
### D. Return a JSON object as JSON type
110120

111121
The following example returns a JSON object as **json** type.
@@ -120,16 +130,6 @@ SELECT JSON_OBJECTAGG('a':1 RETURNING JSON);
120130
{"a":1}
121131
```
122132

123-
[!INCLUDE [ssresult-md](../../includes/ssresult-md.md)]
124-
125-
| object_id | column_list |
126-
| --- | --- |
127-
| 3 | `{"bitpos":12,"cid":6,"colguid":13,"hbcolid":3,"maxinrowlen":8,"nullbit":11,"offset":10,"ordkey":7,"ordlock":14,"rcmodified":4,"rscolid":2,"rsid":1,"status":9,"ti":5}` |
128-
| 5 | `{"cmprlevel":9,"fgidfs":7,"fillfact":10,"idmajor":3,"idminor":4,"lockres":17,"maxint":13,"maxleaf":12,"maxnullbit":11,"minint":15,"minleaf":14,"numpart":5,"ownertype":2,"rcrows":8,"rowsetid":1,"rsguid":16,"scope_id":18,"status":6}` |
129-
| 6 | `{"cloneid":6,"dbfragid":8,"id":1,"partid":3,"rowsetid":7,"segid":5,"status":9,"subid":2,"version":4}` |
130-
| 7 | `{"auid":1,"fgid":5,"ownerid":3,"pcdata":10,"pcreserved":11,"pcused":9,"pgfirst":6,"pgfirstiam":8,"pgroot":7,"status":4,"type":2}` |
131-
| 8 | `{"fileid":2,"filename":4,"name":3,"status":1}` |
132-
133133
### E. Return aggregated result with four columns
134134

135135
The following example returns a result with four columns from a `SELECT` statement containing `SUM` and `JSON_OBJECTAGG` aggregates with `GROUP BY GROUPING SETS`. The first two columns return the `id` and `type` column value. The third column `total_amount` returns the value of `SUM` aggregate on the `amount` column. The fourth column `json_total_name_amount` returns the value of `JSON_OBJECTAGG` aggregate on the `name` and `amount` columns.

0 commit comments

Comments
 (0)