使用SSIS导入列时,XML转为中文/日文

时间:2018-01-09 05:48:07

标签: sql-server xml ssis etl

场景:我在变量中有一个文件路径(E:\..\abc.xml),我需要将该文件的内容导入到表格中。

XML内容:

<?xml version="1.0"?>
<x:books xmlns:x="urn:books">
   <book id="bk001">
      <author>Writer</author>
      <title>The First Book</title>
      <genre>Fiction</genre>
      <price>44.95</price>
      <pub_date>2000-10-01</pub_date>
      <review>An amazing story of nothing.</review>
   </book>

   <book id="bk002">
      <author>Poet</author>
      <title>The Poet's First Poem</title>
      <genre>Poem</genre>
      <price>24.95</price>
      <pub_date>2011-11-11</pub_date>
      <review>Least poetic poems.</review>
   </book>
</x:books>

我使用this link将内容插入到表中。所以问题是,包正在成功运行,但插入的内容不是XML内容,而是其他语言(中文或日文)。

这是我的包

enter image description here

Get Filepath,将变量转换为输出列,因此输出列XMLFile的位置为E:\..\abc.xml

这是我的Import Column配置

enter image description here

enter image description here

enter image description here

我的输出是

enter image description here

任何建议都会有所帮助。

1 个答案:

答案 0 :(得分:2)

此问题可能是由数据类型冲突引起的,只是尝试将目标列数据类型从DT_NTEXT更改为DT_WSTR,长度= 4000

如果它不起作用

按照以下链接中的建议进行操作:

解决方法

尝试将数据插入到不稳定的表(列类型NVarchar)中,使用执行SQL语句将数据传输到目标。