下面的JSON数据是表中的一个字段。在下面的JSON数据中,我需要使用SQL查询将expLevel
中“Not available”的值替换为“Not listed”。使用SQL查询替换JSON中的数据
"Information": {
"Name": [],
"Class": [],
"Degree": ["Graduate or professional degree"],
"major": [],
"skill": [],
"expLevel": ["0 to 2 years",
"Not available",
"3 to 5 years"],
"certificationtype": ""
}
我已经试过这样:
update sr set filter = replace(filter, '"Not available"', '"available" , "listed"')
from sharedreports_check sr
where filter like '%"expLevel":[[]"%Not available%"%'
但它不工作。
请让我知道什么是SQL查询来代替它。
仅供参考,现在Json在sql server 2016中支持。现在我们可以查询json类型,就像我们在xml类型中查询一样。 – KumarHarsh