简体   繁体   中英

How to get json object property without using OPENJSON

Following is my script to get specific value(OldPTValue, NewPTValue) from table HistoryTracking .
I'm using OPENJSON but getting compatibility issue.
Is there any way to get data without using OPENJSON in sql server 2016?

SELECT 
    (
        SELECT [Number] 
        FROM OPENJSON( CHT.OldValues, '$.Employee' ) 
        WITH ([Number] NVARCHAR(25) '$.PaymentTerms')) AS OldPTValue, 
    (
        SELECT [Number] 
        FROM OPENJSON( CHT.NewValues, '$.Employee' ) 
        WITH ([Number] NVARCHAR(25) '$.PaymentTerms')
    ) AS NewPTValue,
    CHT.InsertedBy,
    CHT.InsertedDate 
FROM HistoryTracking CHT 
ORDER BY CHT.Employee, CHT.InsertedDate desc

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM