问题描述
我正在尝试使用 SSIS pkg 导入 excel 数据,但它正在更改数据类型并转换为其他带有十进制的格式.
I am trying to import excel data using SSIS pkg but it is changing data type and converting to some other format with decimal.
我从设定范围内提取数据
I pull data from a set range
示例:范围 A5:AB20
我的数据列 A5 (M)= 1.2
My data Column A5 (M)= 1.2
SSIS 导入类似 120000.001237
我是 SSIS 导入 A5 = 1.2
I was SSIS to import A5 = 1.2
我试过了,但失败了...
I tried this but am failing...
Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:UsersABCDPrograms.xlsx;Extended Properties="EXCEL 12.0 XML;HDR=YES;IMEX=1";
原始数据是从一些旧系统导入的,我无法在那里进行更改.
Original Data is imported from some legacy system and I cannot make changes there.
请直接.谢谢
推荐答案
您需要在 Excel 电子表格和数据库之间的数据流任务中使用派生列转换:
You need to use a Derived Column transformation in your dataflow task between the Excel spreadsheet and the database:
Excel 文件,我知道您说您的电子表格显示的是 1.2,但我看不到单元格中的内容,因此看起来较大的值确实是单元格中的内容:
Excel file, I know you say your spreadsheet is showing 1.2 but I can't see what's in the cell, so it does look like the larger value is what is held in the cell:
派生转换任务,将值(除以 100000)四舍五入到小数点后一位,替换列值:
Derived transformation task, rounds the value (divided by 100000) to 1 decimal place, replacing the column value:
结果数据库条目,此列的数据类型设置为 DECIMAL(8,1) 或您需要的任何前面的数字):
Resulting database entry, this column's datatype is set to DECIMAL(8,1) or however many preceeding digits you need):
希望有帮助
这篇关于SSIS Excel 数据导入 - 行中的混合数据类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!