Skip columns in BIML SSIS Script

孤者浪人 提交于 2019-12-04 16:42:18

There are several ways to filter a column list in Biml.

You can filter on column names or parts of column names:

<#=table.GetColumnList(c => c.Name != "dwh_timestamp")#>
<#=table.GetColumnList(c => c.Name.StartsWith("dwh_"))#>

A more reusable solution is to create Annotations on the columns and filter on the annotation:

<Columns>
  <# foreach (var column in table.Columns) { #>
    <#=column.GetBiml()#>
  <# } #>
  <Column Name="dwh_timestamp" DataType="DateTime" IsNullable="true">
    <Annotations>
      <Annotation AnnotationType="Tag" Tag="IsDWHColumn">Yes</Annotation>
    </Annotations>
  </Column>
</Columns>

<#=table.GetColumnList(c => c.GetTag("IsDWHColumn") != "Yes")#>

You choose your own annotation strategy, of course. You may want to use "true" and "false" instead of "Yes" and "No", or reverse the annotation logic to specify which columns are source columns instead of DWH columns.

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