从文本文件到SQL Server 2005表的批量复制错误 [英] Bulk copy Error from textfile to sql server 2005 table

查看:81
本文介绍了从文本文件到SQL Server 2005表的批量复制错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将表从远程服务器复制到文本文件中,复制的记录的一部分如下所示;

001가00190718
001가00190718

然后,使用批量插入"将文本文件复制到本地服务器表中,
由于出现错误,我无法继续批量插入",
----
第461行第10列的批量加载数据转换错误(截断)(参考).第462行第10栏的大容量数据转换错误(截断)(参考).第463行第10列的大容量数据转换错误(截断)(参考).第4521行第10列(参考)的大容量数据转换错误(截断).第5210行第10栏的大容量数据转换错误(截断)(参考).行5357的第10列(参考)的批量加载数据转换错误(截断).
----
特殊字符(韩文字母)给我错误.

i copied a table into a textfile from a remote server, part of the copied record is shown below;

마가00190718
마가00190718

I then, copy the textfile into my local server table using "Bulk Inset",
I could not continue with the "Bulk Insert" because an error appears,
----
Bulk load data conversion error (truncation) for row 461, column 10 (Ref). Bulk load data conversion error (truncation) for row 462, column 10 (Ref). Bulk load data conversion error (truncation) for row 463, column 10 (Ref). Bulk load data conversion error (truncation) for row 4521, column 10 (Ref). Bulk load data conversion error (truncation) for row 5210, column 10 (Ref). Bulk load data conversion error (truncation) for row 5357, column 10 (Ref).
----
The special character(Korean Letter), gives me the error.

How can i prevent this or what will i do with?

推荐答案

该列使用哪种数据类型?
What kind of datatype are you using for that column? The nvarchar(size) datatype stores unicode characters, so should work.


strSQL =批量插入mbmis..GLTRNHIST"& _
"FROM ["& rTxtFileDir& "\ dGLTxnUpload.txt]"& _
与(代码页= 65001,FIELDTERMINATOR =" |",ROWTERMINATOR ="\ n")"

CODEPAGE = 65001 --->代表Unicode(UTF-8)
这是因为记录中包含特殊字符(韩文字母)
strSQL = "BULK INSERT mbmis..GLTRNHIST " & _
"FROM [" & rTxtFileDir & "\dGLTxnUpload.txt] " & _
"WITH (CODEPAGE = 65001, FIELDTERMINATOR = ''|'', ROWTERMINATOR = ''\n'' )"

CODEPAGE = 65001 ---> represents Unicode(UTF-8)
This is because, the records contains special Characters (Korean Letters)


这篇关于从文本文件到SQL Server 2005表的批量复制错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆