SSIS - 从 DT_STR 到 int 的数据转换
SSIS - Data Conversion from DT_STR to int
如何在 SSIS 数据流任务中应用以下转换
cast(gift_amount as int)/100
在派生列转换编辑器中,我无法更改数据类型。它在给出 typecast
函数时给出 0xC0049064
错误。
您可以使用 script component
- 添加一个
Script Component
- 将
gift_amount
标记为输入列
- 添加小数或浮点类型的输出列(例如
outColumn
)
添加以下代码:(使用vb.net)
If Not Row.giftamount_IsNull AndAlso
Not String.IsNullOrEmpty(Row.giftamount) Then
Row.outColumn = CDec(CInt(Row.giftamount) / 100)
Else
Row.outColumn_IsNull = True
End If
你应该试试
((DT_I4)gift_amount)/100
此外,在派生列编辑器 window 中,您可以添加其他类型的强制转换 - 在编辑器的右上角查看其中一些选项。
如何在 SSIS 数据流任务中应用以下转换
cast(gift_amount as int)/100
在派生列转换编辑器中,我无法更改数据类型。它在给出 typecast
函数时给出 0xC0049064
错误。
您可以使用 script component
- 添加一个
Script Component
- 将
gift_amount
标记为输入列 - 添加小数或浮点类型的输出列(例如
outColumn
) 添加以下代码:(使用vb.net)
If Not Row.giftamount_IsNull AndAlso Not String.IsNullOrEmpty(Row.giftamount) Then Row.outColumn = CDec(CInt(Row.giftamount) / 100) Else Row.outColumn_IsNull = True End If
你应该试试
((DT_I4)gift_amount)/100
此外,在派生列编辑器 window 中,您可以添加其他类型的强制转换 - 在编辑器的右上角查看其中一些选项。