【发布时间】:2019-08-30 20:02:48
【问题描述】:
我正在处理需要加载到 SQL SERVER 2012 中的嵌套 JSON 数据。嵌套 JSON 包含两个根,即一列和另一行。我需要将行中的值放入列中。请看下面的结构:
{
"tables": [
{
"name": "PrimaryResult",
"columns": [
{
"name": "timestamp",
"type": "datetime"
},
{
"name": "id",
"type": "string"
},
{
"name": "name",
"type": "string"
},
{
"name": "url",
"type": "string"
},
{
"name": "duration",
"type": "real"
}
],
"rows": [
[
"2019-04-08T13:09:52.871Z",
"244",
"Internal",
"https://google.com",
1245,
]
]
}
]
}
结果:
timestamp id name url duration
2019-04-08 244 Internal https://google.com 1245
这里,在 sql server 中,它应该从列中获取列名,从行中获取每列的值
【问题讨论】:
-
这是一个复杂的问题,但 Phil Factor 前段时间分享了一些解决方案。 red-gate.com/simple-talk/sql/t-sql-programming/…
-
是的 Luis,这是一个有点复杂的场景,实际上这些值没有在键值中定义,而是像数组一样对待。
标签: sql json sql-server ssis ssis-2012