You can store it in a varchar(max) column, but it is not recommended because then you will not be able to query it. So another option is to extract the values from the json and store these values in table.
However, if you insist on storing json in database, you should also consider using MongoDB as it natively stores json in database and you can even query it.
If your result is in a fixed pattern create a table with same schema returned from the result.
Create a User defined table type in sql server with the same schema.
From C# code get the result from the URL and de-serialize it then insert the values into a Datatable which again has the same schema as the userDefined table type resides in SQL server.
Pass the whole table at once using stored procedure.
In stored procedure you can insert those records by just using a single
insert into [DESTINATION_TABLE]
select columns from [@TABLE VARIABLE WITH USER DEFIEND DATA TYPE]
Nitin SontakkeRank #264 · 9.6K reputationPosted Jul 15, 2016, 2:28 AM EDT
Vishal JadavRank #1,691 · 901 reputationPosted Jul 15, 2016, 2:45 AM EDT
Nayeem Mohammed27 reputationPosted Jul 15, 2016, 2:47 AM EDT
Nayeem Mohammed27 reputationPosted Jul 15, 2016, 2:49 AM EDT
ketan borsdiyaRank #2,258 · 624 reputationPosted Jul 15, 2016, 3:03 AM EDT
Vishal JadavRank #1,691 · 901 reputationPosted Jul 15, 2016, 3:08 AM EDT
Vishal JadavRank #1,691 · 901 reputationPosted Jul 15, 2016, 3:09 AM EDT
Manas MohapatraRank #182 · 13.2K reputationPosted Jul 15, 2016, 3:45 AM EDT
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts