From 648735586539ff2519b659a059d2c7a0942e7055 Mon Sep 17 00:00:00 2001 From: davidbaxterbrowne Date: Mon, 8 May 2017 17:05:27 -0500 Subject: [PATCH] Update LoadFromAzureBlobStorage.sql Just ran through this and got the error Cannot obtain the required interface ("IID_IColumnsInfo") from OLE DB provider "BULK" for linked server "(null)" on the BULK INSERT. Had to add ROWTERMINATOR = '0x0a', Also make the CCI optional, as it requires premium, and a sample should not do that. Also BULK INSERT to a temp table fails with: Msg 12703, Level 16, State 1, Line 55 Referenced external data source "MyAzureBlobStorage" not found. So added a note to the CREATE TABLE. --- .../LoadFromAzureBlobStorage.sql | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/samples/features/sql-bulk-load/load-from-azure-blob-storage/LoadFromAzureBlobStorage.sql b/samples/features/sql-bulk-load/load-from-azure-blob-storage/LoadFromAzureBlobStorage.sql index 979743770a..93235dc321 100644 --- a/samples/features/sql-bulk-load/load-from-azure-blob-storage/LoadFromAzureBlobStorage.sql +++ b/samples/features/sql-bulk-load/load-from-azure-blob-storage/LoadFromAzureBlobStorage.sql @@ -1,4 +1,5 @@ -/******************************************************************************** + +--/******************************************************************************** * Note: You can export file and create format file using bcp out command: * *>bcp "SELECT Name, Color, Price, Size, Quantity, Data, Tags FROM Product" queryout product.dat -d ProductCatalog -T @@ -46,7 +47,8 @@ WITH ( TYPE = BLOB_STORAGE, DROP TABLE IF EXISTS Product; GO - +--Create a permanent table. A temp table currently is not supported for BULK INSERT, although it will will work +--with OPENROWSET CREATE TABLE dbo.Product( Name nvarchar(50) NOT NULL, Color nvarchar(15) NULL, @@ -54,8 +56,8 @@ CREATE TABLE dbo.Product( Size nvarchar(5) NULL, Quantity int NULL, Data nvarchar(4000) NULL, - Tags nvarchar(4000) NULL, - INDEX cci CLUSTERED COLUMNSTORE + Tags nvarchar(4000) NULL + --,INDEX cci CLUSTERED COLUMNSTORE ) GO @@ -69,6 +71,7 @@ FROM 'product.csv' WITH ( DATA_SOURCE = 'MyAzureBlobStorage', FORMAT='CSV', CODEPAGE = 65001, --UTF-8 encoding FIRSTROW=2, + ROWTERMINATOR = '0x0a', TABLOCK); -- 2.2. INSERT file exported using bcp.exe into Product table @@ -93,4 +96,4 @@ FROM OPENROWSET(BULK 'product.bcp', DATA_SOURCE = 'MyAzureBlobStorage', FORMATFILE='data/product.fmt', FORMATFILE_DATA_SOURCE = 'MyAzureBlobStorage') as data -GROUP BY Color; \ No newline at end of file +GROUP BY Color;