Page 1 of 1

Converting Varchar to Decimal

Posted: Thu Jun 22, 2006 10:45 pm
by bapajju
Hello,

We have a data source which is a Sequential file. All the fields in that file are defined as Varchar. But in the target (teradata) database couple of fields are defined as Decimal as they are some Quantity fields. Now if a blank value come from the source file the datastage job throws and error saying that "Can not convert "" to long type". We tried to change the blank values to NULL, but still it does not work out. Can anyone help on this, please.

Thanks in advance.

Posted: Thu Jun 22, 2006 10:54 pm
by chulett
By 'NULL', do you actually mean @NULL?

Posted: Fri Jun 23, 2006 12:39 am
by ray.wurlod
Check the Format tab of your Sequential File stage. If the "null representation" field is empty, "" ought to be translated to null. Also check the Columns grid in case the null representation has been overridden on a per-column basis - you will need to scroll right to find this setting.

Otherwise, include an "empty to null" transformation in your Transformer stage.

Code: Select all

(If InLink.TheColumn = "" Then @NULL Else InLink.TheColumn)