I have a source feild whose datatype is varchar. I have to convert this to SmallInt in Target. What kind of a function I can use in Transformer.
Please suggest.
Thanks
Varchar to SmallInt
Moderators: chulett, rschirm, roy
The chapter on conversions should cover that (I don't have it accessible right now) but I am sure that this is one where an implicit conversion will work, i.e. just drag the VarChar column to an appropriately defined SmallInt output column.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
You can use StringToDecimal(<input port.)
If you want to check before converting you can use the following:
If IsNull(<input port>) Then SetNull()
Else If Trim(<input port>) Then Setnull()
Else Trim(<Input port>)
If you want to check the validity of the data before converting you can also use the IsValid function
If IsValid ("unit32",<input port>) Then StringtoDecimal(<input port>)
If you want to check before converting you can use the following:
If IsNull(<input port>) Then SetNull()
Else If Trim(<input port>) Then Setnull()
Else Trim(<Input port>)
If you want to check the validity of the data before converting you can also use the IsValid function
If IsValid ("unit32",<input port>) Then StringtoDecimal(<input port>)