utf-8 文本文件的 bcp 文件结尾错误
我们当前的设置使用 bcp 将 .txt 文件 (UTF-16) 加载到 sql server (2012) 中。
我们已将这些文件的编码从 UTF-16 更改为 UTF-8。这节省了我们的处理时间(从源系统导出时)。
然而,随着这一变化。我们现在遇到文件结束错误。
错误 = [microsoft][sql server 本机客户端 10.0]bcp 数据文件中遇到意外的 eof
这是我们的 bcp 错误文件中的内容。
#@ 第 2 行,第 1 列:BCP 数据文件中遇到意外的 EOF @#
这是我们拥有的最小文件之一。它包含提取时间。
我尝试过以下 bcp 命令:
[server].master.dbo.xp_cmdshell 'bcp "aida_ods_nl_prd.imp.t_aidaextracttime" in c:\temp\aidaextracttime.txt -fc:\temp\bcp_format_files\aidaextracttime.fmt -q -c raw -w -f2 -r\n -t -s [server]\sql2012 -ec:\temp\bcp_errors\aidaextracttime_errors.txt'
Does bcp support utf-8 in sql 2012? 如果是, 我做错了什么?行终止符-r/n是否不正确>
@bcp_parms
==========
-q - set quoted_identifiers on
-C RAW - codepage - no conversion from one codepage to another
-w - performs the bulk copy operation using Unicode characters
-F1 - First row is the 1st row (no column headers)
-F2 - First row is the 2nd row (row 1 has column headers)
-r\r - row terminator (override default with a carriage return)
-T - connect to SQL Server with a trusted connection
Our current setup uses bcp to load .txt files (UTF-16) into sql server (2012).
We have changed the encoding of these files from UTF-16 to UTF-8. This saves our processing times (when exporting from the source system).
However, upon this change. We now encounter an end of file error.
error = [microsoft][sql server native client 10.0]unexpected eof encountered in bcp data-file
This is what is in our bcp error file.
#@ Row 2, Column 1: Unexpected EOF encountered in BCP data-file @#
This is one of the smallest files we have. It contains the Extract time.
I have tried the following bcp command:
[server].master.dbo.xp_cmdshell 'bcp "aida_ods_nl_prd.imp.t_aidaextracttime" in c:\temp\aidaextracttime.txt -fc:\temp\bcp_format_files\aidaextracttime.fmt -q -c raw -w -f2 -r\n -t -s [server]\sql2012 -ec:\temp\bcp_errors\aidaextracttime_errors.txt'
Does bcp support utf-8 in sql 2012?
If yes,
What am I doing wrong? Is the row terminator -r/n not correct>
@bcp_parms
==========
-q - set quoted_identifiers on
-C RAW - codepage - no conversion from one codepage to another
-w - performs the bulk copy operation using Unicode characters
-F1 - First row is the 1st row (no column headers)
-F2 - First row is the 2nd row (row 1 has column headers)
-r\r - row terminator (override default with a carriage return)
-T - connect to SQL Server with a trusted connection
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论