在sql server中解析Json值
我正在使用sqlserver 2012。我的tablebindings包含以下数据在sql server中解析Json值,json,parsing,Json,Parsing,我正在使用sqlserver 2012。我的tablebindings包含以下数据 e_id f_id value 1001 1 [{"id":85574},{"id":169794},{"id":151336}]') 1002 1 [{"id":85574},{"id":169794}]') i want to select e_id and value(parsed value) from the above table
e_id f_id value
1001 1 [{"id":85574},{"id":169794},{"id":151336}]')
1002 1 [{"id":85574},{"id":169794}]')
i want to select e_id and value(parsed value) from the above table.
Sample output.
e_id value
1001 85574
1001 169794
1001 151336
1002 85574
1002 16974
我尝试使用在中找到的parsejson函数UserDefined函数
无法解析表中的值。我认为您必须首先在服务器端用c解析这个json,然后在数据库中只插入值部分 我认为您必须首先在服务器端用c解析这个json,然后在数据库中只插入值部分
select StringValue from parsejson('[{"id":85574},{"id":169794},{"id":151336}]')->This query Returns result.
select e_id,(Select stringvalue from parseJSON(v1.value)) from bindings v1 where v1.value<>'' and v1.f_id=1
showing error message Subquery returned more than 1 value"
Below query also.
select (select stringvalue from parseJSON(v1.value)) from bindings v1 where f_id=1