bcp Load data from CSV into Azure SQL Database

2019-07-22 11:41发布

问题:

Attempting to upload a CSV file to Azure via bcp. Command will run and returns 0 rows copied.

I suspect it is a formatting issue but I cannot figure out where. Any help would be greatly appreciated!

file format:

field1,field2,field3,field4,field5,field6,field7,field8,field9,field10,field11,field12,field13,field14

Format file:

12.0 14 1 SQLCHAR 2 100 "" 1 field1 SQL_Latin1_General_CP1_CI_AS 2 SQLCHAR 2 100
"" 2 field2
SQL_Latin1_General_CP1_CI_AS 3 SQLCHAR 2 100
"" 3 field3
SQL_Latin1_General_CP1_CI_AS 4 SQLCHAR 2 100
"" 4 field4
SQL_Latin1_General_CP1_CI_AS 5 SQLCHAR 2 100
"" 5 field5
SQL_Latin1_General_CP1_CI_AS 6 SQLCHAR 2 100
"" 6 field6
SQL_Latin1_General_CP1_CI_AS 7 SQLCHAR 2 100
"" 7 field7
SQL_Latin1_General_CP1_CI_AS 8 SQLCHAR 2 100
"" 8 field8
SQL_Latin1_General_CP1_CI_AS 9 SQLCHAR 2 100
"" 9 field9
SQL_Latin1_General_CP1_CI_AS 10 SQLCHAR 2 100
"" 10 field10
SQL_Latin1_General_CP1_CI_AS 11 SQLCHAR 2 100
"" 11 field11
SQL_Latin1_General_CP1_CI_AS 12 SQLCHAR 2 100
"" 12 field12
SQL_Latin1_General_CP1_CI_AS 13 SQLCHAR 2 100
"" 13 field13
SQL_Latin1_General_CP1_CI_AS 14 SQLCHAR 2 100
"" 14 field14
SQL_Latin1_General_CP1_CI_AS

Powershell command:

bcp tableName in C:\FileToLoad.csv -c -f fileFormat-c.fmt -S serverName -d databaseName -U user -P password