OpenJSON converts an array of objects inwards a variable inwards JSON Format to a rowset
that tin survive queried alongside measure SQL Select statement.
Here is an example:
We are going to await at a JSON listing of my get-go batch of students who took my course of report shown here.
["wclass",
{"student":{"name":"Linda Jones","legacySkill":"Access, VB 5.0"}
},
{"student":{"name":"Adam Davidson","legacySkill":"Cobol, MainFrame"}
},
{"student":{"name":"Charles Boyer","legacySkill":"HTML, XML"}
}]
This is the upshot of running OpenJSON using the above:
Now y'all tin run a SELECT inquiry alongside a with clause on the rows returned past times OpenJSON every bit shown here:
The get-go fellow member "wclass" has nulls for the selected columns. It exists because it truly was inwards the master copy XML that got converted to JSON.
Here are my to a greater extent than recent JSON related articles:
JSON validation inwards SQL Server:
https://hlthnworkout.blogspot.com//search?q=using-json-validator-in-sql-server
Nested JSON using SQL Server 2012:
https://hodentekmsss.blogspot.com/search?q=json
Retrieve JSON formatted information from SQL Anywhere 17
https://hlthnworkout.blogspot.com//search?q=using-json-validator-in-sql-server
that tin survive queried alongside measure SQL Select statement.
Here is an example:
We are going to await at a JSON listing of my get-go batch of students who took my course of report shown here.
["wclass",
{"student":{"name":"Linda Jones","legacySkill":"Access, VB 5.0"}
},
{"student":{"name":"Adam Davidson","legacySkill":"Cobol, MainFrame"}
},
{"student":{"name":"Charles Boyer","legacySkill":"HTML, XML"}
}]
This is the upshot of running OpenJSON using the above:
Now y'all tin run a SELECT inquiry alongside a with clause on the rows returned past times OpenJSON every bit shown here:
The get-go fellow member "wclass" has nulls for the selected columns. It exists because it truly was inwards the master copy XML that got converted to JSON.
Here are my to a greater extent than recent JSON related articles:
JSON validation inwards SQL Server:
https://hlthnworkout.blogspot.com//search?q=using-json-validator-in-sql-server
Nested JSON using SQL Server 2012:
https://hodentekmsss.blogspot.com/search?q=json
Retrieve JSON formatted information from SQL Anywhere 17
https://hlthnworkout.blogspot.com//search?q=using-json-validator-in-sql-server
Komentar
Posting Komentar