Dynamically Accessing Columns in Script component

  • Hello all,

    In a script component, one can access a column's value by using Row.MyColumnName. I was wondering, is there a way I can dynamically access columns at run time?

    I have a check procedure which identifies columns that have dirty data and stores the name of the column in an arraylist. The action performed on the dirty data will be the same for each column I want to implement a cleaning procedure on every column stored in my arraylist. Something like:

    For each ColumnName as string in myArrayList

    Row.(ColumnName) = MyScrubFunction

    Next

    Of course the above is incorrect, but I wanted to show what I'm trying to do. Can this or something like this be done?

    Thanks,

    Strick

  • I had looked at this in both SQL 2005 and 2008 and the column list is not enumerable in a script component without using a REALLY convoluted .Net reflection process. This causes terrible performance. Did I say terrible, I meant horrible.. You are better off writing a custom data-flow task to do this.

    CEWII

  • If you can use third-party solutions, check the commercial CozyRoc Script Component Plus. It is an extension of the standard Script Component and you can access the list of columns at runtime. Also the extension doesn't use reflection and the performance is excellent.

    ---
    SSIS Tasks Components Scripts Services | http://www.cozyroc.com/

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

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