Can You Change Flat File Connection via Script Task?

  • Hello,

    I have a flat files that come in from various sources, hence they have various formats. They are all text files though and I only need one common field that (foruntately) is always the same format.

    Instead of replicating these steps, or having all of the connections in the pacakge, I'd like to have to one flat file connection and be able to change which connection manager it uses.

    I keep thinking there should be a way to do this in the Script Task. Perhaps modifying a property such as System.Data.OleDB.OleDbConnection({name})=@variable+".txt"

    Any ideas?

    Thanks,

    Peter

  • pcapazzi (3/12/2009)


    Hello,

    I have a flat files that come in from various sources, hence they have various formats. They are all text files though and I only need one common field that (foruntately) is always the same format.

    Instead of replicating these steps, or having all of the connections in the pacakge, I'd like to have to one flat file connection and be able to change which connection manager it uses.

    I keep thinking there should be a way to do this in the Script Task. Perhaps modifying a property such as System.Data.OleDB.OleDbConnection({name})=@variable+".txt"

    Any ideas?

    Thanks,

    Peter

    Peter,

    I don't understand how flat file connection relates to OleDbConnection. Can you elaborate what property you want to be able to change?

    If you want to control connection manager properties, you can do it with expressions defined on the connection manager. You can use variables in your expression and use a script to modify the related variable.

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

  • You can ditch the dbconnection object I suggested. It was just to get the general idea across of changing a source. My goal is to programatically swap one of the (text file) Connection Managers for another.

    Say if you received phones books from two different sources. And in your connection managers window you have yellowbook, whitebook, and a dummybook. Say the yellow book is a delimited text file while the white book is fixed width. The dummy book can be either but doesn't matter as it's only there as a placeholder

    In the package the dummybook would be the text file source and during the execution I'd like to displace that input component with yellowbook and then whitebook.

    Can a script task handle this?

  • pcapazzi (3/16/2009)


    You can ditch the dbconnection object I suggested. It was just to get the general idea across of changing a source. My goal is to programatically swap one of the (text file) Connection Managers for another.

    Say if you received phones books from two different sources. And in your connection managers window you have yellowbook, whitebook, and a dummybook. Say the yellow book is a delimited text file while the white book is fixed width. The dummy book can be either but doesn't matter as it's only there as a placeholder

    In the package the dummybook would be the text file source and during the execution I'd like to displace that input component with yellowbook and then whitebook.

    Can a script task handle this?

    Which input component in particular you are referring to?

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

  • Flat File

  • pcapazzi (3/16/2009)


    Flat File

    Unfortunately it is impossible with the standard framework. There might be a possible solution, which involves using CozyRoc commercial library. Let me know if interested.

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

Viewing 6 posts - 1 through 5 (of 5 total)

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