Skip to content

Commit d8c73cf

Browse files
Merge pull request microsoft#234 from davidbaxterbrowne/patch-1
Update LoadFromAzureBlobStorage.sql
2 parents a975756 + 6487355 commit d8c73cf

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)