Data transformation

  • Hi,

    I am using a fixed width flat file souce which  has 5 spaces for a particular column.

     I  am using a derived column component in my package to  convert that  column  into  numeric [DT_WSTR] to [DT_NUMERIC].

    i am adding a new colum with the following condition

    (column_name == "     ") ? 0 : (DT_NUMERIC,5,0)column_name

    i need to  insert 0 if blank  spaces exist in the flat file else whatever value that is present for that column should be inserted.

    its working fine except when there is a 0(zero) in the flat file for this column the derived column component fails. 

     

    Please help.

  • Hi,

    I have noticed that you are converting the field into Numeric(5,0) which I gather is full numbers, right?

    Anyways, I simulated your problem and the same problem occurs. By changing the expression from

    (column_name == " ") ? 0 : (DT_NUMERIC,5,0)column_name

    to

    (column_name == " ") ? 0 : (DT_I4)column_name [i.e. to integer] I was able to run the package without failing. Though, I am not sure why the package fails when it is trying to convert 0 to numeric(5,0).

    Regards

    Gogula

    (http://sqlserveruniverse.com)

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply