SSIS Setting OLE DB Destination OpenRowset property

  • I have OLE DB Destination I need to set on the fly.

    My Package takes a Flate file in Reads the File Name Creates a table and inserts the data into the table.

    The problem is Don't know the file name/Table Name tell runtime. How can Set the table name on fly for a OLE DB Destincation.

    Michael

  • Use the CustomPropertyCollection["OpenRowset"] property on the component cast as IDTSComponentMetaData100, like so:

    Executables pExecs = pkg.Executables;

    foreach (Executable pExec in pExecs)

    {

    TaskHost taskHost = (TaskHost)pExec;

    Console.WriteLine("Executable name = " + taskHost.Name);

    //Test if the task is a data flow

    if (taskHost.InnerObject is Microsoft.SqlServer.Dts.Pipeline.Wrapper.MainPipe)

    {

    taskHost.Name = "DF_" + ptableName;

    //Cast the Executable as a data flow

    MainPipe pipe = (MainPipe)taskHost.InnerObject;

    foreach (IDTSComponentMetaData100 comp in pipe.ComponentMetaDataCollection)

    {

    comp.CustomPropertyCollection["OpenRowset"].Value = "dbo." + ptableName;

    }

    }


    Seth Wilpan

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

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