Reputation: 49
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
Upvotes: 1
Views: 3030
Reputation: 36
I may be wrong, but it seems like that's what you may need there. https://learn.microsoft.com/en-us/sql/relational-databases/json/json-data-sql-server?view=sql-server-ver15
Upvotes: 1