简体   繁体   English

BCP命令将文本文件插入SQL表

[英]BCP command insert text file to SQL table

I am trying to import into SQL a text file using this BCP command: 我正在尝试使用此BCP命令将文本文件导入SQL:

bcp test.dbo.bcp2 in C:\\Test\\test.txt -c -t -SSQServer -U user -P test1 -t \\t -r\\n -e C:\\Test\\error.txt C:\\ Test \\ test.txt中的bcp test.dbo.bcp2 -c -t -SSQServer -U用户-P test1 -t \\ t -r \\ n -e C:\\ Test \\ error.txt

The text.txt file has \\t as column delimiter and \\n as row delimiter. text.txt文件以\\ t作为列定界符,以\\ n作为行定界符。

The error received is Unexpected EOF. 收到的错误是意外的EOF。

I can confirm that the SQL table has the right table definition so there should not be any conversion errors. 我可以确认SQL表具有正确的表定义,因此应该没有任何转换错误。

i think no need to put any delimiter have text which is well arranged example if you have data in the excel copy and paste it in the text file and run the command 我认为没有必要放置任何定界符的文本,例如,如果您在excel复制中有数据并将其粘贴到文本文件中并运行命令,

BCP tablename in c:\\test.txt -S server name -Uuserid -Ppassword -c c:\\ test.txt中的BCP表名-S服务器名称-Uuserid -Ppassword -c

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM