Page 1 of 1

Warning "cannot convert null....

Posted: Fri Jun 08, 2007 6:06 am
by cosec
How Can I not have a warning incase a null value is being loaded from a fixed with sequential file to a db2 table ?

how can I get datastage to treat spaces as null ?

AdjBar..Transformer_6: At row 1, link "Output", while processing column "VERSION_NO"
Value treated as NULL
Attempt to convert String value " " to Long type unsuccessful

Posted: Fri Jun 08, 2007 6:19 am
by chulett
They are two different things. If you want spaces to be NULL in your target, explicitly convert them in your job.

Posted: Fri Jun 08, 2007 8:40 am
by cosec
Done...but I thought there would be an easier way to handle it.....but what about the warning ? can i make it not specify it as a warning
chulett wrote:They are two different things. If you want spaces to be NULL in your target, explicitly convert them in your job. ...

Posted: Fri Jun 08, 2007 8:43 am
by ray.wurlod
If you specify " " as the representation of NULL in this field, in the Columns grid, then " " will automatically be read as NULL, which IS valid as a Long, so the warning will disappear!

Posted: Fri Jun 08, 2007 8:56 am
by cosec
I do the following to handle it
if trim(Arg1) ="" then @null else trim(Arg1)

Are you saying I have no other alternative but to validate every column ???
ray.wurlod wrote:If you specify " " as the representation of NULL in this field, in the Columns grid, then " " will automatically be read as NULL, which IS valid as a Long, so the warning will disappear! ...

Posted: Fri Jun 08, 2007 10:10 am
by chulett
No, read the reply again and check the help for the 'Null String' column option in the Sequential File stage.

Posted: Fri Jun 08, 2007 4:14 pm
by ray.wurlod
You can set the default for all columns on the Format tab. However, the default of "" is probably better in most cases; where you want " " (that is, a space) to be the representation of NULL, I recommend doing this explicitly at the column level.

Incidentally, Trim(" ") returns " ", never "". You would need Convert() to eliminate all space characters.