Skip to content

Commit

Permalink
Merge pull request #234 from davidbaxterbrowne/patch-1
Browse files Browse the repository at this point in the history
Update LoadFromAzureBlobStorage.sql
  • Loading branch information
jovanpop-msft committed Sep 21, 2017
2 parents a975756 + 6487355 commit d8c73cf
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -46,16 +47,17 @@ 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,
Price money NOT NULL,
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

Expand All @@ -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
Expand All @@ -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;

0 comments on commit d8c73cf

Please sign in to comment.