Skip to main content
added 85 characters in body
Source Link
Mairaj Ahmad
  • 14.6k
  • 2
  • 28
  • 40

SQL server 2016 supports json data parsing using OPENJSON. You can use OPENJSON to map json data to rows and columns.

BelowYour json Data

[
 { "id" : 2,"name": "John"},
 { "id" : 5,"name": "John"}
]

Here is a simple examplehow you can handle json in sql

//@pJson is json data passed from code.  

INSERT INTO YourTable (id, Name)
 SELECT id, name
 FROM OPENJSON(@pJson)
 WITH (id int,
       Namename nvarchar(max))

Here is a detailed article which covers this topic.

SQL server 2016 supports json data parsing using OPENJSON. You can use OPENJSON to map json data to rows and columns.

Below is a simple example

//@pJson is json data passed from code.  

INSERT INTO YourTable (id, Name)
 SELECT id, name
 FROM OPENJSON(@pJson)
 WITH (id int,
       Name nvarchar(max))

Here is a detailed article which covers this topic.

SQL server 2016 supports json data parsing using OPENJSON. You can use OPENJSON to map json data to rows and columns.

Your json Data

[
 { "id" : 2,"name": "John"},
 { "id" : 5,"name": "John"}
]

Here is how you can handle json in sql

//@pJson is json data passed from code.  

INSERT INTO YourTable (id, Name)
 SELECT id, name
 FROM OPENJSON(@pJson)
 WITH (id int,
       name nvarchar(max))

Here is a detailed article which covers this topic.

Source Link
Mairaj Ahmad
  • 14.6k
  • 2
  • 28
  • 40

SQL server 2016 supports json data parsing using OPENJSON. You can use OPENJSON to map json data to rows and columns.

Below is a simple example

//@pJson is json data passed from code.  

INSERT INTO YourTable (id, Name)
 SELECT id, name
 FROM OPENJSON(@pJson)
 WITH (id int,
       Name nvarchar(max))

Here is a detailed article which covers this topic.