JSON arrays using FOR JSON PATH SQLHow can I prevent SQL injection in PHP?Add a column with a default value to an existing table in SQL ServerHow do I format a Microsoft JSON date?Can comments be used in JSON?How can I pretty-print JSON in a shell script?Inserting multiple rows in a single SQL query?What is the correct JSON content type?How do I UPDATE from a SELECT in SQL Server?Why does Google prepend while(1); to their JSON responses?What are the options for storing hierarchical data in a relational database?
Multi tool use
Why am I getting an electric shock from the water in my hot tub?
Which are more efficient in putting out wildfires: planes or helicopters?
What is this fluorinated organic substance?
Existence of infinite set of positive integers s.t sum of reciprocals is rational and set of primes dividing an element is infinite
Trace in the category of propositional statements
GFCI versus circuit breaker
Was Wolfgang Unziker the last Amateur GM?
Merging two data frames into a new one with unique items marked with 1 or 0
Why would Dementors torture a Death Eater if they are loyal to Voldemort?
Are the plates of a battery really charged?
Are all notation equal by derivatives?
Square wave to sawtooth wave using two BJT
What was the ASCII end of medium (EM) character intended to be used for?
Which high-degree derivatives play an essential role?
Is it theoretically possible to hack printer using scanner tray?
How to track mail undetectably?
What does this Pokemon Trainer mean by saying the player is "SHELLOS"?
Is this house-rule removing the increased effect of cantrips at higher character levels balanced?
Variable declaration inside main loop
Can I hire several veteran soldiers to accompany me?
Emphasize numbers in tables
Tricky riddle from sister
What could a Medieval society do with excess animal blood?
How soon after takeoff can you recline your airplane seat?
JSON arrays using FOR JSON PATH SQL
How can I prevent SQL injection in PHP?Add a column with a default value to an existing table in SQL ServerHow do I format a Microsoft JSON date?Can comments be used in JSON?How can I pretty-print JSON in a shell script?Inserting multiple rows in a single SQL query?What is the correct JSON content type?How do I UPDATE from a SELECT in SQL Server?Why does Google prepend while(1); to their JSON responses?What are the options for storing hierarchical data in a relational database?
First time using FOR JSON PATH in MSSQL to generate a JSON output as below, HELP! I need to create a JSON output like that from a SQL View, I am having trouble writing the Query using FOR PATH specially for the UNCCID and ViewModels array
"UNCCID": 4,
"viewModels": [
"year": 2019,
"departments":
"IT":
"id": 1,
"name": "Computer Science",
"Teachers": [
"name": "ABC",
"teacher_id": 1,
,
"name": "ZXQ",
"teacher_id": 2,
]
]
My Table looks like this
sql json sql-server
add a comment |
First time using FOR JSON PATH in MSSQL to generate a JSON output as below, HELP! I need to create a JSON output like that from a SQL View, I am having trouble writing the Query using FOR PATH specially for the UNCCID and ViewModels array
"UNCCID": 4,
"viewModels": [
"year": 2019,
"departments":
"IT":
"id": 1,
"name": "Computer Science",
"Teachers": [
"name": "ABC",
"teacher_id": 1,
,
"name": "ZXQ",
"teacher_id": 2,
]
]
My Table looks like this
sql json sql-server
What is your view structure?
– Zhorov
Mar 25 at 17:26
@Zhorov I have added my table on the Q please take a look mostly its only have values which I have to join with another table
– Rudy
Mar 25 at 18:07
Please post the structure of all tables involved and how they are linked together.
– Andrea
Mar 27 at 10:53
add a comment |
First time using FOR JSON PATH in MSSQL to generate a JSON output as below, HELP! I need to create a JSON output like that from a SQL View, I am having trouble writing the Query using FOR PATH specially for the UNCCID and ViewModels array
"UNCCID": 4,
"viewModels": [
"year": 2019,
"departments":
"IT":
"id": 1,
"name": "Computer Science",
"Teachers": [
"name": "ABC",
"teacher_id": 1,
,
"name": "ZXQ",
"teacher_id": 2,
]
]
My Table looks like this
sql json sql-server
First time using FOR JSON PATH in MSSQL to generate a JSON output as below, HELP! I need to create a JSON output like that from a SQL View, I am having trouble writing the Query using FOR PATH specially for the UNCCID and ViewModels array
"UNCCID": 4,
"viewModels": [
"year": 2019,
"departments":
"IT":
"id": 1,
"name": "Computer Science",
"Teachers": [
"name": "ABC",
"teacher_id": 1,
,
"name": "ZXQ",
"teacher_id": 2,
]
]
My Table looks like this
sql json sql-server
sql json sql-server
edited Mar 25 at 18:06
Rudy
asked Mar 25 at 17:23
RudyRudy
1441 gold badge2 silver badges12 bronze badges
1441 gold badge2 silver badges12 bronze badges
What is your view structure?
– Zhorov
Mar 25 at 17:26
@Zhorov I have added my table on the Q please take a look mostly its only have values which I have to join with another table
– Rudy
Mar 25 at 18:07
Please post the structure of all tables involved and how they are linked together.
– Andrea
Mar 27 at 10:53
add a comment |
What is your view structure?
– Zhorov
Mar 25 at 17:26
@Zhorov I have added my table on the Q please take a look mostly its only have values which I have to join with another table
– Rudy
Mar 25 at 18:07
Please post the structure of all tables involved and how they are linked together.
– Andrea
Mar 27 at 10:53
What is your view structure?
– Zhorov
Mar 25 at 17:26
What is your view structure?
– Zhorov
Mar 25 at 17:26
@Zhorov I have added my table on the Q please take a look mostly its only have values which I have to join with another table
– Rudy
Mar 25 at 18:07
@Zhorov I have added my table on the Q please take a look mostly its only have values which I have to join with another table
– Rudy
Mar 25 at 18:07
Please post the structure of all tables involved and how they are linked together.
– Andrea
Mar 27 at 10:53
Please post the structure of all tables involved and how they are linked together.
– Andrea
Mar 27 at 10:53
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55343345%2fjson-arrays-using-for-json-path-sql%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55343345%2fjson-arrays-using-for-json-path-sql%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
ak,R,INEZEf47FH3vGcMVhNtaUEDrDNPianRm7D5TzWy7E,PY3KyJNsFva5NBGpvJHY,E,Zk,Zsip4NCXK4U68Pl
What is your view structure?
– Zhorov
Mar 25 at 17:26
@Zhorov I have added my table on the Q please take a look mostly its only have values which I have to join with another table
– Rudy
Mar 25 at 18:07
Please post the structure of all tables involved and how they are linked together.
– Andrea
Mar 27 at 10:53