mirror of
https://github.com/Microsoft/sql-server-samples.git
synced 2025-12-08 14:58:54 +00:00
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.
This commit is contained in:
committed by
GitHub
parent
2a5b27a95d
commit
6487355865
+8
-5
@@ -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;
|
||||
GROUP BY Color;
|
||||
|
||||
Reference in New Issue
Block a user