SSIS:无法转换类型为#System; Decimal'的对象。输入' System.Char []'

时间:2017-03-22 07:07:44

标签: c# sql-server postgresql ssis

我正在从SQL Server 2008 R2到PostgreSQL 9.5进行数据集成。

我有以下详细信息的表格:

:在SQL Server中

create table test
(
    cola int,
    colb numeric(18,0),
    colc varchar(50),
    cold datetime,
    cole bit,
    colf char(1)
);

:在PostgreSQL中

create table test
(
    cola int,
    colb numeric(18,0),
    colc varchar(50),
    cold timestamp(0),
    cole boolean,
    colf char(1)
);

套餐详情:

来源:OLE DB源(SQL Server)

数据转换:在列colc到DT_WSTR

目的地:ADO NET目的地(PostgreSQL)

错误详情:

  

[ADO NET目标[129]]错误:数据插入期间发生异常,从提供程序返回的消息是:无法转换类型为' System.Decimal'的对象。输入' System.Char []'。

数据转换: enter image description here

映射: enter image description here

示例数据:在SQL Server中

insert into test1 values(1,NULL,'z','2017-02-12 12:21:50.000',1,'C');
insert into test1 values(2,1344,'Xuz','2017-02-12 12:21:50.000',0,'D');
insert into test1 values(3,NULL,'T','2017-02-12 12:21:50.000',1,'E');

错误: enter image description here

输入和输出属性

enter image description here

enter image description here

2 个答案:

答案 0 :(得分:0)

您的列映射看起来很好,您必须使用高级编辑器检查列数据类型。

右键点击Ado.net Destination - > Input and Output Columns标签 - >检查列数据类型是否正确定义。

旁注:为什么转换colb如果是数字列

答案 1 :(得分:0)

以下数据转换对我来说很好。

数据转换:我已在数据转换部分中将colbNUMERIC转换为CHAR,并且对我有效。

colb string[DT_STR]

enter image description here

这种转换对我来说很奇怪,但它的工作正常,这很重要。

如果我在这里错了,请告诉我。