I have created a console app in SSDT VS 2017 which reads a list of tables based on a SQL query and generates an SSIS package to transfer the records to another server. A few of the tables have columns which contain country names with special characters in the column name. The package is generated successfully and when I open the package using SSDT I am able to see that all the mappings were done successfully, but upon executing the package I receive the following error:
Load OleDb Table:Warning: The external columns for OleDb Destination OleDb Table are out of synchronization with the data source columns. The column "CÔTE_DIVOIRE" needs to be added to the external columns.
The column "RÉUNION" needs to be added to the external columns.
The column "SAINT-BARTHÉLEMY" needs to be added to the external columns.
The OleDb Destination OleDb Table.Inputs[OLE DB Destination Input].ExternalColumns[SAINT-BARTHÉLEMY] needs to be removed from the external columns.
The OleDb Destination OleDb Table.Inputs[OLE DB Destination Input].ExternalColumns[RÉUNION] needs to be removed from the external columns.
The OleDb Destination OleDb Table.Inputs[OLE DB Destination Input].ExternalColumns[CÔTE_DIVOIRE] needs to be removed from the external columns.
My code is based on API Sample - OleDb Source and OleDb Destination
The code that performs the mapping is as follows:
IDTSVirtualInput100 destVirInput = destInput.GetVirtualInput();
IDTSInputColumnCollection100 destInputCols = destInput.InputColumnCollection;
IDTSExternalMetadataColumnCollection100 destExtCols = destInput.ExternalMetadataColumnCollection;
IDTSOutputColumnCollection100 sourceColumns = srcComponent.OutputCollection[0].OutputColumnCollection;
// The OLEDB destination requires you to hook up the external columns
foreach (IDTSOutputColumn100 outputCol in sourceColumns)
{
// Get the external column id
IDTSExternalMetadataColumn100 extCol = (IDTSExternalMetadataColumn100)destExtCols[outputCol.Name];
if (extCol != null)
{
// Create an input column from an output col of previous component.
destVirInput.SetUsageType(outputCol.ID, DTSUsageType.UT_READONLY);
IDTSInputColumn100 inputCol = destInputCols.GetInputColumnByLineageID(outputCol.ID);
if (inputCol != null)
{
// map the input column with an external metadata column
destDesignTimeComponent.MapInputColumn(destInput.ID, inputCol.ID, extCol.ID);
}
}
}