How to reconfigure the column information on a fla

2019-06-26 19:17发布

问题:

I have a Flat File Source that is reading data from a flat file. We have recently added a new column to this flat file.

The flat file data is inserted into a database table. To accommodate the new field in the destination component, I used the ALTER TABLE statement to add the new column to the table. That is the only change I have done.

Should the mapping between flat file and destination component automatically change? I do not see the additional column present in the flat file anywhere within the SSIS package.

How do I configure the additional column in the flat file within SSIS package so that flat file source can pass the data to the destination component?

回答1:

If you added a new column to the flat file, you need to update the Flat File Connection Manager to reflect the new changes. Flat File Connection Manager will be present under the Connection Manager tab at the bottom of the package.

Sample scenario illustrated using SSIS 2012:

Let's assume that you have a flat file with columns StateCode and StateName.

When you configure the Flat File Connection Manager, you will see these columns configured under Advanced tab page as shown below.

If you modify the flat file to add an additional column, say by adding the new column named CountryCode.

The flat file connection manager will not contain the new column definition. You need to open the Flat File Connection Manager to add the new column or you could delete the Flat File Connection Manager and create a new one with the new flat file column definition.

You need to click New and select appropriate option to insert the column. You cannot move the column positions. So, make sure you select the right option to add the columns. Set the appropriate properties to define the column.

When you modify source or destination schema, it will affect the source and destination components within data flow task. You might see a warning icon on the component as shown below because the component is out of sync with the metadata information of the connection manager that it is associated with.

Double-click the component showing the warning and click OK on the editor to resolve the mapping issue.

Hope that helps.



回答2:

When you alter the metadata of an underlying component such as a flat file or a database, SSIS doesn't automatically refresh all the available columns. You have to do this manually.

  1. Open the source component's editor and navigate to the "Columns" properties (on the left) and verify all of your external columns from the flat file are there and are selected as output columns.
  2. Repeat this process for the Mappings property window of your destination component. Verify all flat file columns are mapped to the proper destination column.


回答3:

The simplest way of updating your columns in your flat file source is to reset the columns on your flat file connection.

  1. Open Your flat file connection from connection managers
  2. Select Columns (below General)
  3. Click Reset Columns - this then includes any new columns.

Of course you need to be careful if you have made custom changes to the data types, et cetera.