Detect new column in source not mapped to destination and fail in SSIS

六月ゝ 毕业季﹏ 提交于 2019-12-01 22:32:23

Update 1

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:

  1. Declare a variable that contains the columns count (when you designed the package) then add an Execute SQL Task that check the current columns count (SELECT Count(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = ?). If count are not identical then throw an exception.
  2. Create a reference table which contains the Source table columns and add a Execute SQL Task to check whether there are new added columns (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.
  3. Use an Execute SQL Task to read from the database schema auditing table:

Initial Answer

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:

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!