Skip to content

Commit 6487355

Browse files
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.
1 parent 2a5b27a commit 6487355

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

samples/features/sql-bulk-load/load-from-azure-blob-storage/LoadFromAzureBlobStorage.sql

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
/********************************************************************************
1+
2+
--/********************************************************************************
23
* Note: You can export file and create format file using bcp out command:
34
*
45
*>bcp "SELECT Name, Color, Price, Size, Quantity, Data, Tags FROM Product" queryout product.dat -d ProductCatalog -T
@@ -46,16 +47,17 @@ WITH ( TYPE = BLOB_STORAGE,
4647

4748
DROP TABLE IF EXISTS Product;
4849
GO
49-
50+
--Create a permanent table. A temp table currently is not supported for BULK INSERT, although it will will work
51+
--with OPENROWSET
5052
CREATE TABLE dbo.Product(
5153
Name nvarchar(50) NOT NULL,
5254
Color nvarchar(15) NULL,
5355
Price money NOT NULL,
5456
Size nvarchar(5) NULL,
5557
Quantity int NULL,
5658
Data nvarchar(4000) NULL,
57-
Tags nvarchar(4000) NULL,
58-
INDEX cci CLUSTERED COLUMNSTORE
59+
Tags nvarchar(4000) NULL
60+
--,INDEX cci CLUSTERED COLUMNSTORE
5961
)
6062
GO
6163

@@ -69,6 +71,7 @@ FROM 'product.csv'
6971
WITH ( DATA_SOURCE = 'MyAzureBlobStorage',
7072
FORMAT='CSV', CODEPAGE = 65001, --UTF-8 encoding
7173
FIRSTROW=2,
74+
ROWTERMINATOR = '0x0a',
7275
TABLOCK);
7376

7477
-- 2.2. INSERT file exported using bcp.exe into Product table
@@ -93,4 +96,4 @@ FROM OPENROWSET(BULK 'product.bcp',
9396
DATA_SOURCE = 'MyAzureBlobStorage',
9497
FORMATFILE='data/product.fmt',
9598
FORMATFILE_DATA_SOURCE = 'MyAzureBlobStorage') as data
96-
GROUP BY Color;
99+
GROUP BY Color;

0 commit comments

Comments
 (0)