SQLTeam.com | Weblogs | Forums

How to parse json data in SQL server 2012?

sql2012

#1

I am using sql server 2012.I have been assigned a task where one of my column(JsonText) of table(Sample) contain json data.I want to parse that data and insert into columns of another table(Test).I searched on net 'openjson'is supported in sql server 2016.How to do in sql server2012.

Table1 : Sample
Id JsonText Active

JsonText
webaddress?{'data':'{"PId": "XXXX","Status": "YES","Name":"XXX","Address":"XXXX","MobileNumber":"xxx"}'}

I am intrested only 'PID,Address,MobileNumber' columns not all.

Table Test structure like this
Id,PID,Address,MobileNumber


#2

A quick google got this: https://www.simple-talk.com/sql/t-sql-programming/consuming-json-strings-in-sql-server/