Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ssis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
SSIS派生列表达式-删除前导零_Ssis - Fatal编程技术网

SSIS派生列表达式-删除前导零

SSIS派生列表达式-删除前导零,ssis,Ssis,我有一个包由于带有数字字符串的负号而失败,例如: 000000000-25.00 派生列表达式为: ISNULL(wstr_Payment_Amount) || TRIM(wstr_Payment_Amount) == "" ? (DT_CY)0 : (DT_CY)wstr_Payment_Amount 列的数据类型为money。我在派生列上重定向了一行,以确认导致失败的是负号 这是我的 FINDSTRING(wstr_Payment_Amount, "-", 1) >0 ? TRIM

我有一个包由于带有数字字符串的负号而失败,例如:

000000000-25.00

派生列表达式为:

ISNULL(wstr_Payment_Amount) || TRIM(wstr_Payment_Amount) == "" ? (DT_CY)0 : (DT_CY)wstr_Payment_Amount
列的数据类型为money。我在派生列上重定向了一行,以确认导致失败的是负号

这是我的

FINDSTRING(wstr_Payment_Amount, "-", 1) >0  ? TRIM(SUBSTRING(wstr_Payment_Amount, FINDSTRING(wstr_Payment_Amount, "0-", 1), 8)) : wstr_Payment_Amount

我正在使用SSIS 2008

如果您使用的是两个派生列,请将其作为字符串保留在第一个列中

ISNULL(wstr_Payment_Amount) || TRIM(wstr_Payment_Amount) == "" ? (DT_WSTR,100)"0" : (DT_WSTR,100)wstr_Payment_Amount
我认为你真的很亲近,但是一旦你发现了负面的迹象……
FINDSTRING(wstr_Payment_Amount, "-", 1) >0  ? (DT_CY) ("-" + replace(wstr_Payment_Amount,"-","")) : (DT_CY)wstr_Payment_Amount

这只会将“-”移到前面,所有的零都会消失。

谢谢Keith!它工作得很好。我刚刚添加了ISNULL(wstr_Payment_Amount)| | TRIM(wstr_Payment_Amount)==”,以解释null或空白。。谢谢你的帮助!