gpt4 book ai didi

azure - Azure Synapse Analytics 上此代码中的 WITH (jsonContent varchar(MAX)) AS [result] 的含义是什么

转载 作者:行者123 更新时间:2023-12-03 06:37:24 27 4
gpt4 key购买 nike

我无法理解为什么我们要写with (doc nvarchar(max)) as rows

JSON FILE

{"date_rep":"2020-07-24","day":24,"month":7,"year":2020,"cases":3,"deaths":0,"geo_id":"AF"}
{"date_rep":"2020-07-25","day":25,"month":7,"year":2020,"cases":7,"deaths":0,"geo_id":"AF"}
{"date_rep":"2020-07-26","day":26,"month":7,"year":2020,"cases":4,"deaths":0,"geo_id":"AF"}
{"date_rep":"2020-07-27","day":27,"month":7,"year":2020,"cases":8,"deaths":0,"geo_id":"AF"}

打开此 JSON 文件的代码从这里开始。

select
JSON_VALUE(doc, '$.date_rep') AS date_reported,
JSON_VALUE(doc, '$.countries_and_territories') AS country,
CAST(JSON_VALUE(doc, '$.deaths') AS INT) as fatal,
JSON_VALUE(doc, '$.cases') as cases,
doc
from openrowset(
bulk 'https://demoaccname.dfs.core.windows.net/demoadlscontainer/afg.json',

format = 'csv',
fieldterminator ='0x0b',
fieldquote = '0x0b'
) with (doc nvarchar(max)) as rows

最佳答案

jsonContent nvarchar(max) 创建一个列名为 jsonContent 的外部表。

in 
FROM
OPENROWSET(
BULK 'https://XXXXX',
FORMAT = 'CSV',
FIELDQUOTE = '0x0b',
FIELDTERMINATOR ='0x0b',
ROWTERMINATOR = '0x0b'
) with (**jsonContent nvarchar(max)**) as rows

enter image description here

关于azure - Azure Synapse Analytics 上此代码中的 WITH (jsonContent varchar(MAX)) AS [result] 的含义是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/74766804/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com