Lets say there is a table A that has column Information
, and data is stored there in JSON format. JSON string, stored there, may have properties Comment
and Timestamp
or properties comment
and timestamp
. Like this:
[{"Timestamp":"2018-04-11 18:14:59.9708","Comment":"first comment"}]
[{"timestamp":"2017-04-11 18:14:59.9708","comment":"second comment"}]
[{"Timestamp":"2019-04-11 18:14:59.9708","Comment":"third comment"}, {"timestamp":"2017-04-11 18:14:59.9708","comment":"last comment"}]
Below script parses the JSON string only for capital case properties, and throw error for JSON string with small cases.
Select jsonInfo.*
From OPENJSON(@Information, N'$')
with(
Comment nvarchar(max) N'$.Comment',
TimeStamp datetime '$.Timestamp'
) as jsonInfo;
Is there any syntax that return both Comment
or comment
properties, by ignoring case.