我尝试了这样的示例in this GitHub sample并收到以下错误,
-- Create credential with Azure Blob SAS
CREATE DATABASE SCOPED CREDENTIAL xxxstorcred
WITH IDENTITY = 'SHARED ACCESS SIGNATURE',
SECRET = '?sv=2015-12-11&ss=bfqt&srt=sco&sp=rwdl&st=2017-03-14T17%3A52%3A00Z&se=2017-05-31T16%3A52%3A00Z&sig=f45435435TzrsdsdsdC8wonjDMBG0T0GJj717XetLEWReZ64eOrQE%3D';
-- Create external data source with with the roow URL of the Blob storage Account and associated credential.
CREATE EXTERNAL DATA SOURCE xxxstor
WITH ( TYPE = BLOB_STORAGE,
LOCATION = 'https://xxxstor.blob.core.windows.net',
CREDENTIAL= xxxstorcred);
--CREATE DESTINATION TABLE (if not exists)
DROP TABLE IF EXISTS Product;
GO
CREATE TABLE dbo.Product(
Name nvarchar(50) NOT NULL,
Color nvarchar(15) NULL,
Price money NOT NULL,
Size nvarchar(5) NULL,
Quantity int NULL,
Data nvarchar(4000) NULL,
Tags nvarchar(4000) NULL
)
GO
--LOAD
-- INSERT CSV file into Product table
BULK INSERT Product
FROM 'random/product.csv' --random is the container name
WITH ( DATA_SOURCE = 'xxxstor',
FORMAT='CSV', CODEPAGE = 65001, --UTF-8 encoding
FIRSTROW=2,
TABLOCK);
无法批量加载,因为文件" random / product.csv"不可能 打开。操作系统错误代码1117(请求不能 由于I / O设备错误而执行。)。
我错过了什么?
答案 0 :(得分:3)
我已经尝试过您提供的github示例中的t-sql。它工作正常。从我的测试中,有两种可能导致此错误:
1)容器名称不正确
2)SAS SECRET不正确
根据您的描述,我认为您的SAS秘密不正确。这是您使用的秘密:
SECRET ='?sv = 2015-12-11& ss = bfqt& srt = sco& sp = rwdl& st = 2017-03-14T17%3A52%3A00Z& se = 2017-05-31T16% 3A52%3A00Z&安培; SIG = f45435435TzrsdsdsdC8wonjDMBG0T0GJj717XetLEWReZ64eOrQE%3D&#39 ;;
作为我的测试,我们需要删除'?' 。请尝试以下秘密:
SECRET =' sv = 2015-12-11& ss = bfqt& srt = sco& sp = rwdl& st = 2017-03-14T17%3A52%3A00Z& se = 2017-05-31T16%3A52 %3A00Z&安培; SIG = f45435435TzrsdsdsdC8wonjDMBG0T0GJj717XetLEWReZ64eOrQE%3D&#39 ;;
有关如何生成SAS的信息,请参阅this article。
答案 1 :(得分:3)