我正在尝试从语句中的 [key] 行值中创建一个
select * from openjson(@json)
表。openjson(@json) 语句为我提供了包含 53 个 [key] 行值的结果,这是一个小片段:
[key] [value] [type]
_id 5b05390c5d222f0059209918 1
ean 65485555 1
name NULL 0
holder {"_id":"5b0538355d222f00585db6f1","name":"***... 5
root {"_id":"5b05390c5d222f005920990a","holder":{"_id":"5b0538885... 5
assigner {"_id":"5b0538885d222f00570aca19","name":"***... 5
created 2018-05-23T09:49:00+0000 1
children [] 4
address 1
timezone Etc/GMT-1 1
我想要一个看起来像这样的表:
table1
[_id] [ean] [name] [holder] [etc...]
5b05390c5d222f0059209918 65485555 NULL {"_id":"5b0538355d222...}
我还希望能够将另一个 JSON 中的值插入到同一个表中
insert into table1 ()
select [value] from openjson(@json2)
谢谢!