Processing JSON in MS SQL 2014 / 2012

One of the new additions to MS SQL 2016 is support for JSON data. It’s pretty much similar to what we have in SQL 2014 for XML processing – similair functions and processing features.

But what if we need to process JSON data but only SQL 2014 server is available? Well, for simple reading of properties we could just use some string manipulation – it will be fast and more or less readable:

FROM tb1
JOIN tb2 on tb2.bvin = 
        ,CHARINDEX('"bvin":"', tb1.json) + LEN('"bvin":"')
        ,CHARINDEX('"', tb1.json, CHARINDEX('"bvin":"', tb1.json) + LEN('"bvin":"')) - CHARINDEX('"bvin":"', tb1.json) - LEN('"bvin":"')

-- from:
Czytaj dalej Processing JSON in MS SQL 2014 / 2012