2017-06-22 11 views
1

sqlserver 2012.Myテーブル(バインディング)を使用しています。次のデータが含まれています。SQL ServerのJson値の解析

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 

iが ​​

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 

ていないテーブルからの値を解析することで見出さparsejson機能(ユーザ定義関数)を使用してみました。

答えて

0

私はあなたがc#で最初にサーバー側でこのjsonを解析し、DBに値の部分だけを挿入する必要があると思います。