Click here to Skip to main content
15,913,132 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I got a huge json dataset from a web method. Could any one help me to store the data into sql server's table?
Posted
Updated 21-Jul-13 23:12pm
v2
Comments
[no name] 21-Jul-13 13:53pm    
Someone probably could if you asked a question or even if you described some sort of a problem...

1 solution

Json data is simply a text, you could store in any NVARCHAR(MAX) field. But the question is what do you intend to do with it? If you don't want to "query" it, this is just ok.
But if you want to look inside this data during a query operation, than you have to consider several alternatives:
1) You can use some custom functions to deal with the data stored there. This is a good approach: https://www.simple-talk.com/sql/t-sql-programming/consuming-json-strings-in-sql-server/[^]
2) You could translate json to xml (see above link), and than use sql server xml features to query it (http://msdn.microsoft.com/en-us/library/ms189075.aspx[^]).
3) You could create json or bson data type as managed data type, and install this feature on sql server instance. Well this would be the most elegant one. If you implement it, please, share it with us here!

Just a note: if you decide to switch to PostgreSQL, there you already have this data type: http://www.postgresql.org/docs/devel/static/datatype-json.html[^]

Note 2: If you have to deal more with structured data, rather than relational one, you might consider switching to a NoSQL Document Store[^] implementation, where json/bson is the default approach.
 
Share this answer
 
v2
Comments
sunpop 22-Jul-13 5:10am    
Thank you for your help! As I'm receiving huge json dataset from a webmethod in asp.net, I want to store the data in different tables of sql server db. I want to parse it from asp.net or else from sql server. Your help is appreciated! Thank you!
sunpop 22-Jul-13 5:11am    
Now I gave 5 points, if the link you sent, helps me then I'll accept your answer. Thank you!
Zoltán Zörgő 13-Sep-13 13:02pm    
Any progress?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900