Transformation VB Script

  • Hello,

    I am using Microsoft SQL Server 2000 and need some slight help in importing and transforming some data.

    Below is the auto-generated script from Microsoft:

    "Function Main()

    DTSDestination("Code") = DTSSource("Col001")

    DTSDestination("User_Cancel1") = DTSSource("Col002")

    Main = DTSTransformStat_OK

    End Function"

    The first DTSDestination is the primary key of the database, and already has data in it. I want the script to find all matches between "Code" and "Col001", and then update "User_Cancel1" with "Col002".

    If I run the script as is, I am given an error that it cannot insert duplicate data into the table.

    I just want the script to FIND the first variable, and then update the second variable in the row.

    I assume it's easy but I don't know VB well.

    Thanks in advance.

    --Mike Matthews

  • I don't think this is a good Idea, Mike. The code you put in the transformation script is run for each row in the source table, so it would have to connect to the destination data source and issue a query for each row read from the source table.

    I would copy the whole source table into a temporary table in the destination database and then match the rows with a set based query.

    Hope this helps

    Gianluca

    -- Gianluca Sartori

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

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