Using dynamically named table in SSIS data flow ta

2019-06-07 05:00发布

问题:

I'm new to SSIS and am writing a package that includes moving data to a table that is created in a previous Execute SQL Task object.

The issue that I'm encountering is that I am unable to create a data flow destination task that uses a dynamic destination table name.

The intended process is:

  • Execute SQL Task object creates new table based on today's date (i.e. Table1_20111014)
  • Data Flow task moves data from table "Table1" to "Table1_20111014".

The column metadata for Table1 and Table1_20111014 are the same, and does not change. However, the name of the table the data needs to be moved to will change depending on the date at time of execution.

Is it possible to dynamically specify the destination table in a destination data flow object?

If not, are there known workarounds or is using SSIS for this task a bad idea?

回答1:

As long as the meta data remains the same, there is no drawback to using dynamic destination table name.

To accomplish this, on the ole db destination instead of using "table name" or "table name fast load" use the equivalent "from variable" table load option. This obviously assumes you have a variable defined that contains the name of the table created in the execute sql task