bcp Load data from CSV into Azure SQL Database

南笙酒味 提交于 2020-02-04 04:01:27

问题


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

来源:https://stackoverflow.com/questions/49098618/bcp-load-data-from-csv-into-azure-sql-database

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!