SSIS:是否可以删除字符串中的特定字符然后将其转换为整数

SSIS: is it possible to remove a specific character in a string then transform it to integer

我想知道您是否可以处理字符串数据 337-4425 并删除特定字符,如 - 并将其更改为整数数据类型。我很好奇这是否可能。您可以分享您对此的想法,我将不胜感激,并希望向有经验的程序员学习。

编辑 1:我尝试使用像这样的表达式使用派生列 Replace([MyColumn],"-","") 还想知道是否可以像这样 Replace([MyColumn],"-","") || Replace([MyColumn],"*","") 这样做,因为我在尝试时遇到错误。所以我暂时选择了第一个表达式,然后我尝试执行IS然后遇到这个错误。

Error: 0xC0049060 at Data Flow Task, Derived Column [59]: An overflow occurred while converting between data types. The source type is too large to fit in the destination type. Error: 0xC0209029 at Data Flow Task, Derived Column [59]: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR. The "Derived Column" failed because error code 0xC0049060 occurred, and the error row disposition on "Derived Column.Outputs[Derived Column Output].Columns[INTSCBMIN]" specifies failure on error. An error occurred on the specified object of the specified component. There may be error messages posted before this with more information about the failure. Error: 0xC0047022 at Data Flow Task, SSIS.Pipeline: SSIS Error Code DTS_E_PROCESSINPUTFAILED. The ProcessInput method on component "Derived Column" (59) failed with error code 0xC0209029 while processing input "Derived Column Input" (60). The identified component returned an error from the ProcessInput method. The error is specific to the component, but the error is fatal and will cause the Data Flow task to stop running. There may be error messages posted before this with more information about the failure. Error: 0xC02020C4 at Data Flow Task, Flat File Source [73]: The attempt to add a row to the Data Flow task buffer failed with error code 0xC0047020. Error: 0xC0047038 at Data Flow Task, SSIS.Pipeline: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED. The PrimeOutput method on Flat File Source returned error code 0xC02020C4. The component returned a failure code when the pipeline engine called PrimeOutput(). The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing. There may be error messages posted before this with more information about the failure.

我将输出列更改为 numeric 并且我的目标数据类型为 bigint

替换空字符串的破折号,然后将其转换为整数。 在您的数据流中,使用派生列。

(DT_I4)REPLACE([MyColumn],"-","")