Skip to content
Advertisement

Is there any way to insert below nested json data into sql server

I am working on a nested JSON data which I need to load into SQL SERVER 2012. The nested JSON contains two roots i.e. one column and another rows. I need to put value from row into the column. Please see the structure as below:

Result:

Here , in sql server it should take column names from columns and value for each column from rows

Advertisement

Answer

assuming that you store the json into a file named json.txt

Output for create table:

Output for insert into table:

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement