Home » Javascript » Sql query for data stored as JSON

Sql query for data stored as JSON

Posted by: admin August 19, 2018 Leave a comment

Questions:

I have data stored in column as JSON, as shown below:

{“category”:{“value”:CAT, “demo”:A…….

I want to query in SSMS and want an output like:

CAT

I tried “SELECT JSON_QUERY(TABLENAME,’$.CATEGORY’) FROM TABLENAME” which gave result of the

{“value”:CAT, “demo”:A……. but I want only CAT. How do I do that?

Answers: