将数字数据导出到平面文件、SSIS 的问题 [英] Issue exporting Numeric data to Flat file , SSIS
问题描述
我在数据库中有值为 0.546, 0.456
的数值数据.当我尝试使用平面文件管理器将这些值导出到平面文件时,零值被截断,平面文件中仅显示 .546,.456
.
I have numeric data with have value 0.546, 0.456
in the database. When I try to export these values to flat file using flat file manager the zero value is truncated and only .546,.456
is shown in the flat file.
零以外的值没有这个问题.我尝试使用数据转换但没有用
The value other than zero doesn't have this problem. I tried using data conversion but of no use
推荐答案
恐怕您必须先将数字数据转换为 DT_WSTR
.它必须是派生列转换,而不是数据转换,因为您会得到相同的结果.在表达式中,您需要在转换后的数字前面加上 0.不知道负数,但也许它们会有正确的格式(您需要对其进行测试).
I'm afraid you'll have to first convert you numeric data to DT_WSTR
. It has to be Derived Column transformation, not Data Conversion, because you'd get the same result. In expression you need to prepend converted number with 0. Don't know about negative numbers, but maybe they will have correct format (you need to test it).
floor(decimal_column)==0 ? "0" + (DT_WSTR,10)decimal_column : (DT_WSTR,10)decimal_column
我知道这不是您所期望的,但前几天我遇到了同样的问题,无法找到更好的解决方案:)
I know that's not what you expected, but I had the same problem the other day and was unable to finde better solution :).
这篇关于将数字数据导出到平面文件、SSIS 的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!