lgt5100 Posted June 16, 2016 Report Posted June 16, 2016 bhaiyya naku kuda koncham sql cheptava bhaiyya Quote
loveindia Posted June 16, 2016 Author Report Posted June 16, 2016 2 minutes ago, lgt5100 said: bhaiyya naku kuda koncham sql cheptava bhaiyya post your questions here man, we will discuss... Quote
loveindia Posted June 16, 2016 Author Report Posted June 16, 2016 5 minutes ago, tom bhayya said: informative thread loveindia man thanks all chex man... Quote
yomama Posted June 16, 2016 Report Posted June 16, 2016 1 hour ago, loveindia said: so just imagine, you have a webpage where you have the option to update your address or a api call that will send JSON data to add a new customer and so on... earlier since Json is not available in SQL Server, you have to either convert it to XML and then do via SQL or insert by means of application code only... so enta complex logic untey application code anta complex avutundey and there is no more concept of batch processing... and JSON is highly in demand now... so Microsoft started getting that into T-SQL straight... now just JSON pass chestey chalu I can interpret the data myself and work with it and it will faster than the application level of using it man.... Light ga ardam ayindi uncle hands on chesta clarity vastadi Quote
rikki Posted June 16, 2016 Report Posted June 16, 2016 2 hours ago, loveindia said: non - relational representation of data man... similar to xml but more advanced and easy to understand.. its not about easy to understand...most easy to understand/readable is xml for both human and computer..json is less weight thats the biggest bet we get..less weight on wire Quote
sanfunnyguy09 Posted June 16, 2016 Report Posted June 16, 2016 super loveindia.. .net ppl ki kuda baguntadipudu who use sql server Quote
loveindia Posted June 16, 2016 Author Report Posted June 16, 2016 30 minutes ago, rikki said: its not about easy to understand...most easy to understand is xml both human and computer..json is less weight thats the biggest bet we get..less weight on wire ya but xml creation is pain without nodes... from application side easy emo kaani db side nunchi aitey every node match ayyelaaga cheyyali, so much work man... Quote
gunturodu1 Posted June 16, 2016 Report Posted June 16, 2016 3 hours ago, loveindia said: If you are using Json and SQL Server 2016, its an awesome combo man... I am using it hands on currently and super experience so far... just a quick example for newbies interested in this... DECLARE @Json NVARCHAR(MAX) SET @Json = '{"requests": [ { "id": 0, "data": [ { "id": 0, "field": "customerAddress", "stringValue": "2301 Perf. Drive" } ], "where": [ { "id": 0, "field": "customerid", "intValue": 1 }, { "id": 1, "field": "isActive", "stringValue": "1" } ], "table": "custAddress" }, { "id": 1, "data": [ { "id": 0, "field": "customerAddress", "stringValue": "111 West Irving" } ], "where": [ { "id": 0, "field": "customerid", "intValue": 2 }, { "id": 1, "field": "isActive", "stringValue": "1" } ], "table": "custAddress" } ] } ' ;WITH CTE AS ( SELECT * FROM OpenJson(@Json, '$.requests') ) SELECT a.[key] , JSON_VALUE(b.[value], '$.field') AS update_field , JSON_VALUE(b.[value], '$.stringValue') AS update_value , JSON_VALUE(c.[value], '$.field') AS where_field , ISNULL(JSON_VALUE(c.[value], '$.stringValue'), JSON_VALUE(c.[value], '$.intValue')) AS where_value FROM CTE a CROSS APPLY OpenJson(a.[value], '$.data') b CROSS APPLY OpenJson(a.[value], '$.where') c Interesting. Whats the need to send JSON to SQLServer man. This scenario looks helpful, if client gets response as JSON object and he wants to save it immediately. But generally apart of storing data, if we need to do loads of business logic, for that its better to use Object inplace of JSON. and there are simple conversion available JSON to Object by using GSON jar. Quote
gunturodu1 Posted June 16, 2016 Report Posted June 16, 2016 2 hours ago, loveindia said: that means you can query the JSON directly and treat it as data directly... earlier you have to read json and then parse it to an intermediate table(which is dead slow) and then do the operations... now since this is all inbuilt, you can start directly treating the JSON as final version of data and do what ever you like to do with that data man... But JAVA- Hiberante use chesthey its straightforward, JSON gets convert to domain object that store in DB. Quote
loveindia Posted June 16, 2016 Author Report Posted June 16, 2016 11 minutes ago, gunturodu1 said: But JAVA- Hiberante use chesthey its straightforward, JSON gets convert to domain object that store in DB. I am not Java pro man, just basic beginner level... Quote
Quickgun_murugan Posted June 17, 2016 Report Posted June 17, 2016 On 6/16/2016 at 11:09 AM, loveindia said: yooo... etla nersukovali man Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.