简体   繁体   English

Azure Synapse Serverless SQL 池 - 从引用字段中选择时出错

[英]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谢谢

Synapse Studio 的屏幕截图

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.

相关问题 Azure Synapse Studio ServerLess SQL 池访问错误 - Azure Synapse Studio ServerLess SQL Pool Access Error 无法访问 Azure Synapse 中的无服务器 SQL 池 - Cannot access serverless SQL pool in Azure Synapse Azure SQL 的数据库链接到 Azure Synapse Anayltics 无服务器池分析 Z977089840A01401CB077 - Database link for Azure SQL to Azure Synapse Anayltics Serverless SQL Pool 如何在 Azure Synapse 无服务器 SQL 池中使用 CETAS 创建外部表时添加自动递增列? - How to add auto incremented columns while creating External Tables using CETAS in Azure Synapse serverless SQL Pool? 我们可以从管道 azure 突触在无服务器池中执行 sql 查询吗? - can we execute sql query in serverless pool from pipeline azure synapse? 是否可以使用 Azure Synapse Serverless SQL 池过滤动态日期范围? - Is it possible to filter on a dynamic date range with an Azure Synapse Serverless SQL Pool? 将数据从数据块写入 Azure 突触专用池时出错 - Error while writing data from databricks to Azure synapse Dedicated Pool Azure Synapse Serverless SQL 池无法连接但可以连接到专用 SQL 池? - Azure Synapse Serverless SQL Pool Unable to Connect BUT Can connect to Dedicated SQL Pool? 从 Azure Synapse Analytics Spark Pool 连接到 Azure SQL 数据库 - Connecting from Azure Synapse Analytics Spark Pool to Azure SQL Database 使用“ActiveDirectoryPassword”身份验证和 pyodbc 连接到无服务器 Azure Synapse SQL 池时收到“登录超时已过期” - Receiving `Login timeout expired` when connecting to a serverless Azure Synapse SQL pool using `ActiveDirectoryPassword` authentication and pyodbc
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM