transformation script - easy in DTS, not so easy in SSIS : )

  • Hey all - got a problem that seems like it should be simple (and probably is : )

    I'm importing a csv file into a SQL 2005 table and would like to add 2 columns that exist in the table but not in the csv file. I need these 2 columns to contain the current month and year (columns are named CM and CY respectively). How do I go about adding this data to each row during the transformation? A derived column task? Script task? None of these seem to be able to do this for me.

    Here's a portion of the transformation script I was using to accomplish this when we were using SQL 2000 DTS jobs:

    '**********************************************************************

    ' Visual Basic Transformation Script

    '************************************************************************

    ' Copy each source column to the destination column

    Function Main()

    DTSDestination("CM") = Month(Now)

    DTSDestination("CY") = Year(Now)

    DTSDestination("Comments") = DTSSource("Col031")

    DTSDestination("Manufacturer") = DTSSource("Col030")

    DTSDestination("Model") = DTSSource("Col029")

    DTSDestination("Last Check-in Date") = DTSSource("Col028")

    Main = DTSTransformStat_OK

    End Function

    ***********************************************************

    Hopefully this question isnt answered somewhere else, but i did a quick search and came up with nothing.

    I did actually attempt to use the script component in SSIS, and found that there is a "Row" object you can use. However, the only properties I get for that obj are the columns that exist in the source data.

    thanks in advance!

    jm

  • I'm not certain, but I think you could add a Derived column to your Data Flow. 

    Russel Loski, MCSE Business Intelligence, Data Platform

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

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