Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SSIS Use DataFlow task with variables instead of a source database

I have a task that I am working on that has me stumped. Hoping you can help me. I am using a data flow task which is basically inserting a row into a sqlite table. I was doing this using a "SQL Task" but unfortunately the only way to successfully insert a guid into the sqlite table is to convert it as a byte stream using the data flow task. I do not want to use a source database because my data is not flowing from one table to another. I really just want to take my populated variables and convert them to a byte stream which i can then insert successfully into a sqlite database. The issue is, i cannot use a dataflow task without a source database.

My work-around so far has been to declare a source database/table and only one column (but never use it in the data flow). This works fine and I am unable to insert the row into sqlite using my pre-set variables, but i am left with a somewhat annoying message in my Output log every time i do this:

Warning: 0x80047076 at , SSIS.Pipeline: The output column "" (117) on output "OLE DB Source Output" (11) and component "OLE DB Source" (1) is not subsequently used in the Data Flow task. Removing this unused output column can increase Data Flow task performance.

Anyone know of a good way to get this warning not to show up?

like image 969
AlpineCoder Avatar asked Feb 19 '23 07:02

AlpineCoder


1 Answers

In your dataflow choose a Script Component.

When prompted to choose Source, Destination, or Transformation, choose Source.

Add your pre populated variables to the CustomProperties.ReadOnlyVariables section of the script tab.

Go to the Inputs and Outputs section.

Add a column to the default output for each of your variables.

In your script (if using C#) put something similar to the following in the CreateNewOutputRows() section

    Output0Buffer.AddRow();
    Output0Buffer.ContainerName = Variables.ContainerName;
    Output0Buffer.TaskName = Variables.TaskName;
    Output0Buffer.TaskStartDate = Variables.ContainerStartTime;

Save your script.

Connect your script component to your destination object.

like image 173
William Salzman Avatar answered Mar 05 '23 19:03

William Salzman