Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 use bcp to import- no rows copied and no errors

Author  Topic 

ana10
Starting Member

2 Posts

Posted - 2014-01-29 : 04:55:43
Hi,

I tried to do the following command to upload data to azure database:
bcp.exe [azure-test].[user1].[tab2] in D:\Files\tab2.csv -f D:\Files\tab2.fmt -S %server% -a %packetsize% -b %batchsize% -U speedtest@xxxxxx.database.windows.net -P %password% -e d:\Files\error.txt

Result of execution:
Starting copy...

0 rows copied.
Network packet size (bytes): 4096
Clock Time (ms.) Total : 328

Content of tab2.csv:
"
XTB,285N
ABC,123C
EFG,190D
"
If display tab2.csv with end of line characters, it will show:
"
XTB,285N[CR][LF]
ABC,123C[CR][LF]
EFG,190D[CR][LF]
"

The content of tab2.fmt :
"
10.0
2
1 SQLCHAR 2 4 "," 1 vsl_code SQL_Latin1_General_CP1_CI_AS
2 SQLCHAR 2 7 "\r\n" 2 voy_code SQL_Latin1_General_CP1_CI_AS
"

Table structure is:
create table user1.tab2
(vsl_code varchar(4) not null,
voy_code varchar(7) not null
constraint pk_vsl_voy2 primary key (VSL_CODE,VOY_CODE))
;

What is wrong with the command that the data cannot get inserted to the table?

Thanks.
   

- Advertisement -