[英]Azure Synapse Serverless SQL Pool - Error while selecting from quoted fields
I am getting an error while selecting from a CSV file that contains quoted fields using Serverless/ OnDemand SQL Pool in Azure Synapse.从 CSV 文件中选择时出现错误,该文件包含使用无服务器/按需 SQL 池在 Azure Synapse 中的引用字段。 The data contains the field terminator (,) within the fields, but it's quoted with double quotes.数据在字段中包含字段终止符 (,),但它用双引号引起来。 I have even tried to specify the FIELDQUOTE explicitly even though I am using the default quote in the data.即使我在数据中使用默认报价,我什至尝试明确指定 FIELDQUOTE。
My file contains the data as below我的文件包含如下数据
"number", "text"
1, "one"
2, "two"
11, "one, one"
12, "one, two"
The SQL that I ran is as below我跑的SQL如下
SELECT
*
FROM
OPENROWSET(
BULK 'https://mydatalake.dfs.core.windows.net/data/test_quoted_fields.csv',
FORMAT = 'CSV',
PARSER_VERSION = '2.0',
FIELDQUOTE = '"',
FIELDTERMINATOR = ',',
HEADER_ROW = TRUE
) AS [result]
And the error message is as below错误信息如下
Error handling external file: 'Quotes '' must be inside quoted fields at [byte: 10]. '. File/External table name: 'https://mydatalake.dfs.core.windows.net/data/test_quoted_fields.csv'
Please note that I am running the query using Serverless/ OnDemand SQL Pool .请注意,我正在使用Serverless/OnDemand SQL Pool运行查询。
Can someone help please?有人可以帮忙吗? Thanks谢谢
I did try with the same file as yours, you just have missed a ,
after FIELDTERMINATOR = ','
我确实尝试使用与您相同的文件,您只是在FIELDTERMINATOR = ','
之后错过了一个,
Try this:尝试这个:
SELECT
*
FROM
OPENROWSET(
BULK 'https://mydatalake.dfs.core.windows.net/data/test_quoted_fields.csv',
FORMAT = 'CSV',
PARSER_VERSION = '2.0',
FIELDQUOTE = '"',
FIELDTERMINATOR = ',',
HEADER_ROW = TRUE
) AS [result]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.