简体   繁体   English

将 json 从 Azure Blob 存储批量上传到 Azure SQL db 时出错

[英]Error when bulk uploading json to Azure SQL db from Azure Blob Storage

Trying to upload a json response from my blog storage into my sql table raw.尝试将我的博客存储中的 json 响应上传到我的 sql 表 raw 中。 Established the connection, so that is not a problem, however when I try to run建立了连接,所以这不是问题,但是当我尝试运行时

BULK INSERT dbo.httpjson

FROM 'xxxxxx [path]'

WITH ( DATA_SOURCE = 'MyAzureBlobStorage');

I get我明白了

Msg 4866, Level 16, State 1, Line 1
The bulk load failed. The column is too long in the data file for row 1, column 1. Verify that the field terminator and row terminator are specified correctly.

Msg 7399, Level 16, State 1, Line 1
The OLE DB provider "BULK" for linked server "(null)" reported an error. The provider did not give any information about the error.

Msg 7330, Level 16, State 2, Line 1
Cannot fetch a row from OLE DB provider "BULK" for linked server "(null)".

I cannot find out what I am doing wrong, as I am just following MS tutorial: https://docs.microsoft.com/en-us/sql/relational-databases/json/import-json-documents-into-sql-server?view=sql-server-ver16我无法找出我做错了什么,因为我只是在学习 MS 教程: https ://docs.microsoft.com/en-us/sql/relational-databases/json/import-json-documents-into-sql- server?view=sql-server-ver16

I hope someone can help me out as I am finally very close to my goal!我希望有人能帮助我,因为我终于非常接近我的目标了!

Try by providing Field and Row Terminators to datafile尝试为数据文件提供字段和行终止符

One approach to tell the program that reads the data file where one field or row stops, and another field or row begins is with terminating characters .告诉读取数据文件的程序一个字段或行在哪里停止,而另一个字段或行开始的一种方法是使用终止字符 With the help of the terminating characters, you are able to indicate the ending of each field and each row in a data file .借助终止字符,您可以指示数据文件中每个字段和每一行的结尾

FIELDTERMINATOR: - It specifies the character or symbol that indicates the end of one field and start of a new field. FIELDTERMINATOR: -它指定指示一个字段结束和新字段开始的字符或符号。 '\t' is default field terminator. '\t'是默认字段终止符。

ROWTERMINATOR: - It specifies the character or symbol that indicates the end of one row and start of new row. ROWTERMINATOR: -它指定指示一行结束和新行开始的字符或符号。 '\r\n' is default field terminator. '\r\n'是默认字段终止符。

Code Example: -代码示例:-

BULK INSERT myDepartment 
FROM  'C:\myDepartment-c-t.txt'  
WITH ( DATAFILETYPE = 'char', FIELDTERMINATOR = ',', ROWTERMINATOR = '\n' 
);

For reference regarding the above for similar thread, kindly find the link below: -有关上述类似主题的参考,请找到以下链接:-

"Column is too long" error with BULK INSERT BULK INSERT 出现“列太长”错误

Also, find the below documentation link below for more information: -此外,请在下面找到以下文档链接以获取更多信息:-

https://docs.microsoft.com/en-us/sql/relational-databases/import-export/specify-field-and-row-terminators-sql-server?view=sql-server-ver16 https://docs.microsoft.com/en-us/sql/relational-databases/import-export/specify-field-and-row-terminators-sql-server?view=sql-server-ver16

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM