Reputation: 35
I want to insert below data into a SQL Server table
{
"ITEM_NUMBER":"CSC-ENVM",
"SHIPPED_DATE":"1995-08-22T00:00:00",
"STATUS":"Shipped",
"SOURCE":"Shipment"
},
{
"ITEM_NUMBER":"NP-2R",
"SHIPPED_DATE":"1995-03-14T18:23:00",
"STATUS":"Shipped",
"SOURCE":"Shipment"
}
NP-2R |1995-03-14T18:23:00|Shipped |Shipment**
Upvotes: 3
Views: 4956
Reputation: 28938
Just insert into table of a column with Varchar column as mentioned in comments as well
insert into #temp
select '{
"ITEM_NUMBER":"CSC-ENVM",
"SHIPPED_DATE":"1995-08-22T00:00:00",
"STATUS":"Shipped",
"SOURCE":"Shipment"
},
{
"ITEM_NUMBER":"NP-2R",
"SHIPPED_DATE":"1995-03-14T18:23:00",
"STATUS":"Shipped",
"SOURCE":"Shipment"
}'
In SQL 2008,you also can read this JSON data using ParseJson function created by Phil Factor.you can read on about that here...
Consuming JSON Strings in SQL Server
Upvotes: 1