mirror of
https://github.com/Microsoft/sql-server-samples.git
synced 2025-12-08 14:58:54 +00:00
Fixes in Azure Blob Storage load
Corrected cheka of the target table, skipped first row in CSV examplem and added BULK INSERT from bcp file.
This commit is contained in:
+10
-1
@@ -33,8 +33,8 @@ GO
|
||||
CREATE TABLE dbo.Product(
|
||||
Name nvarchar(50) NOT NULL,
|
||||
Color nvarchar(15) NULL,
|
||||
Size nvarchar(5) NULL,
|
||||
Price money NOT NULL,
|
||||
Size nvarchar(5) NULL,
|
||||
Quantity int NULL,
|
||||
Data nvarchar(4000) NULL,
|
||||
Tags nvarchar(4000) NULL,
|
||||
@@ -51,6 +51,15 @@ BULK INSERT Product
|
||||
FROM 'data/product.csv'
|
||||
WITH ( DATA_SOURCE = 'MyAzureBlobStorage',
|
||||
FORMAT='CSV', CODEPAGE = 65001, --UTF-8 encoding
|
||||
FIRSTROW=2,
|
||||
TABLOCK);
|
||||
|
||||
-- INSERT file exported using bcp.exe into Product table
|
||||
BULK INSERT Product
|
||||
FROM 'data/product.bcp'
|
||||
WITH ( DATA_SOURCE = 'MyAzureBlobStorage',
|
||||
FORMATFILE='data/product.fmt',
|
||||
FORMATFILE_DATA_SOURCE = 'MyAzureBlobStorage',
|
||||
TABLOCK);
|
||||
|
||||
-- Read rows from product.dat file using format file and insert it into Product table
|
||||
|
||||
Reference in New Issue
Block a user