Query JSON in SQL Server
Aaron
Codesanook
Aaron
Agenda
Knowledge contribution
Code example
What is JSON?
What is JSON?
{
"id": 1,
"firstName": "Jose",
"lastName": "Realman",
"dateOfBirth":"2012-04-23T18:25:43.511Z"
}
JSON in SQL server
Alternative solutions
JSON in real world
Orchard Core concept
Prepare the demo project
Prepare steps
DEMO
setup the project�simple-query.sql
ISJSON
DEMO
isjson.sql
JSON_VALUE
DEMO
json-value.sql
JSON_QUERY
DEMO
json-query.sql
Convert query result to JSON
SELECT
t.ContentItemId,
t.Title as 'TitlePart.Title',
h.Html as 'HtmlPart.Html'
FROM TitlePart t
INNER join HtmlBodyPart h
ON t.ContentItemId = h.ContentItemId
FOR JSON PATH;
Migrate Orchard version 1 to Orchard version 2
"TitlePart": {
"Title": "Hello world"
},
"MarkdownBodyPart": {
"Html": "Lorem ipsum dolor sit amet"
}
TitlePart table
HtmlBodyPart table
DEMO
create-tables.sql
for-json-path.sql
JSON_MODIFY
DEMO
json-modify.sql
Reference & resources
Question & Answer
It is not about being the best.
It is about always getting better.