bcp sqlcmd bulkinsert中unicode问题,Unexpected EOF encountered in BCP data-file

senario

进入sqlcmd用:out xxx生成数据文件,由于sqlcmd export to file 默认情况下中文乱码,故用-u(unicode)开关

@echo off & setLocal EnableDelayedExpansion
:start
@SET DB=AdventureWorks2012
sqlcmd  -d%DB% -b -iscript.sql -v pa="out.txt" pwd="%cd%" -W -h-1
TIMEOUT 3
sqlcmd  -d%DB% -b -iout.txt -W -h-1 -s^| -u--<strong><strong>由于sqlcmd export to file 默认情况下中文乱码,故用-u(unicode)开关</strong></strong>
pause
GOTO start

到此,中文正常显示

SQLCMD ERROR

Starting copy...
SQLState = S1000, NativeError = 0
Error = [Microsoft][SQL Server Native Client 11.0]Unexpected EOF encountered in BCP data-file

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

原因 datafile in Unicode format 用-c开关导入数据会出错

查看

打开-w开关,导入成功

小结

用bcp  in or out data时

  1. ANSI         --> -c
  2. UNICODE-->-w

Using BULK INSERT to Bulk Import Unicode Character Data

USE AdventureWorks2012;
GO
BULK INSERT myTestUniCharData
   FROM 'C:\myTestUniCharData-w.Dat'
   WITH (
      DATAFILETYPE='widechar', --unicoode
      FIELDTERMINATOR=','
   );
GO
SELECT Col1,Col2,Col3 FROM myTestUniCharData;
GO

参考:

时间: 2024-08-03 19:53:54

bcp sqlcmd bulkinsert中unicode问题,Unexpected EOF encountered in BCP data-file的相关文章

SyntaxError: unexpected EOF while parsing

用Jupyter Notebook编程时,出现 SyntaxError: unexpected EOF while parsing异常, 经检查发现,是由于在编程中,不小心删掉了左括号 ) . 原文地址:https://www.cnblogs.com/xiangsui/p/9853663.html

Unexpected EOF 远程主机强迫关闭了一个现有的连接 如何处理

由于数据量的增大,调用接口的次数会增加. 当连续向目标网站发送多次request后,目标网站可能会认为是,恶意攻击. 于是会抛出requests异常. 测试代码: for i in range(200): # 连续请求200次 requests.post(p['url'], headers=p['headers'], json=p['body'], verify=False) 在python3.6中,异常为 requests.exceptions.SSLError: HTTPSConnectio

Python中Unicode字符串

Python中Unicode字符串 字符串还有一个编码问题. 因为计算机只能处理数字,如果要处理文本,就必须先把文本转换为数字才能处理.最早的计算机在设计时采用8个比特(bit)作为一个字节(byte),所以,一个字节能表示的最大的整数就是255(二进制11111111=十进制255),0 - 255被用来表示大小写英文字母.数字和一些符号,这个编码表被称为ASCII编码,比如大写字母 A 的编码是65,小写字母 z 的编码是122. 如果要表示中文,显然一个字节是不够的,至少需要两个字节,而且

javascript和html中unicode编码和字符转义的详解

原文:http://ulhoo.com/blog/?p=285 1.html中的转义:在html中如果遇到转义字符(如" "),不管你的页面字符编码是utf-8亦或者是GB2312,都会直接打印成相应的字符:而当遇到(如:"\u8981"[此处的8981是16进制值])时,则不会打印成相应字符. /* *html标记的转义 *@example *<p>Hello World!</p> * ||等价于 *<p>Hello World

python中unicode和str的组合

python中unicode对象和str对象拼接在一起,会自动将str对象转换成unicode对象 即:a="aa" b=u"bb" c=a+b type(c)会打印出此对象为unicode对象 另外,json.loads(a)返回的对象,key和value的类型均是unicode类型

Delphi中unicode转汉字函数(转)

源:Delphi中unicode转汉字函数 近期用到这个函数,无奈没有找到 delphi 自带的,网上找了下 有类似的,没有现成的,我需要的是 支持 “\u4f00 ” 这种格式的,即前面带标准的 “\u”  于是改造了一下. 下面是 解码 函数: 方便有需要的人吧,我自己也需要^_^ /// <summary> /// // Unicode转汉字 ,支持自动过滤非 unicode编码,即非 unicode编码不转换 /// 只支持 标准的 类型 \u4e00 这种格式的 转换, 以\u 开头

HttpClient Received an unexpected EOF or 0 bytes from the transport stream

请求https链接时报错,奇怪的是pc1正常,pc2异常 Unhandled Exception: System.AggregateException: One or more errors occurred. ( Received an unexpected EOF or 0 bytes from the transport stream.) ---> System.IO.IOException: Received an unexpected EOF or 0 bytes from the t

mitmproxy--Cannot establish TLS with client (sni: e.crashlytics.com): TlsException(&quot;(-1, &#39;Unexpected EOF&#39;)&quot;,) 解决办法

按崔哥(https://cuiqingcai.com/5391.html)的安装步骤一步步下来,会报这个错误: Cannot establish TLS with client (sni: e.crashlytics.com): TlsException("(-1, 'Unexpected EOF')",) 能使用mitmproxy抓到http请求了,但遇到https抓不到,而且还会阻断https请求. 解决办法: 启动mitmproxy之后,手机网打开网址:mitm.it ,选择匹配

Eclipse中mvn install 报错error in opening zip file

报错信息 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project wms: Compilation failure [ERROR] Failure executing javac, but could not parse the error: [ERROR] 错误: 读取C:\Users\Administrato