DTS Script

  • Hi everbody.

    I created a DTS package to copy data from AS400 to SQL Server.

    But from the AS400 file I would like to copy only the rows in which a specific field (in my case field: "COPY") has the value 1. So I changed the DTS script as follow:

    Function Main()

    if DTSSource("BREAKLVL") = "1" then 'if the value is equal to 1 then copy

    DTSDestination("Copy") = DTSSource("COPY")

    DTSDestination("OVERFLOW") = DTSSource("OVERFLOW")

    DTSDestination("Fiscal_Period") = DTSSource("I2ARCD")

    DTSDestination("Week_Number") = DTSSource("I2")

    end if

    Main = DTSTransformStat_OK

    End Function

    And is not working! Could anybody give me the right direction.

    Thank you,

    Durug

  • I found the solution:

    Function Main()

    if DTSSource("COPY") <> "1" then

    Main = DTSTransformStat_SkipInsert

    else

    DTSDestination("Copy") = DTSSource("COPY")

    DTSDestination("OVERFLOW") = DTSSource("OVERFLOW")

    DTSDestination("Fiscal_Period") = DTSSource("I2ARCD")

    Main = DTSTransformStat_OK

    end if

    End Function

    Thanks anyway,

    Durug

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

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