How can I cause an SSIS 2017 package to fail if a column in the source table does not have a corresponding column in the destination table, or at least a deliberate decision to not include it?
I made a table in both called test with one column, testcol. SSIS transfers the data. Now I added a testcol2 to the source, but not to the destination. The job still runs fine the way it's handled today, but I want that to fail and report an unmapped column error.
After doing more research on this issue, it looks like that ValidatExternalMetadata doesn't do what you're looking for. It will only track the metadata changes occured on the selected columns.
Based on that, i don't think there is an option in SSIS to do this, you must add your custom validation to the package such as:
SELECT Count(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = ?). If count are not identical then throw an exception.SELECT Count(*) FROM Information_schema.Column T1 LEFT JOIN Source Columns T2 ON T1.COLUMN_NAME = T2.Column_name WHERE T2.Column_Name IS NULL) then you check if the result is > 0 then throw an exception.You can achieve this by setting the OLEDB Source ValidatExternalMetadata property to True.
When new columns are added it should throw an exception of type.
VS_NEEDSNEWMETADATA
Be aware that this may take additional time when executing the package.
For more information, refer to:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With