使用BIML脚本

时间:2016-08-19 21:42:10

标签: sql-server visual-studio ssis lookup biml

我在BIMLscript中创建一个查找来创建一个带查找的ssis包。我本质上只是试图演示查找的功能,所以我正在查看自己的表。当我创建包时,它看起来很好。但是当我在VS2013中打开它时,我会收到如下错误:

错误1验证错误。 char1:char1:LKP_char1.Inputs [Extract_Output_LKP_char1] .Columns [chr_1]具有无效的错误或截断行处置。 char.dtsx 0 0

char1是表的名称,LKP_char1是查找的名称,chr_1是第一列的名称。有没有人对如何尝试和调试这个有任何想法。

我的LookUp标记的NoMatchBehavior属性设置为" IgnoreFailure"

<Dataflow Name="<#=table.SsisSafeName#>">
    <Transformations>
     <OleDbSource Name="Extract" ConnectionName="Source">
        <DirectInput>SELECT * FROM <#=table.SchemaQualifiedName#>
        </DirectInput>
    </OleDbSource>
    <Lookup Name="LKP_<#=table.Name#>" 
        NoMatchBehavior="IgnoreFailure" 
        OleDbConnectionName="Source">
            <ExternalTableInput Table="<#=table.SchemaQualifiedName#>">
            </ExternalTableInput>
            <Inputs>
            <# foreach (var column in table.Columns) { #>
                <Column SourceColumn="<#=column.Name#>" TargetColumn="<#=column.Name#>" />
            <# } #>
            </Inputs>
        <Outputs>
            <# foreach (var column in table.Columns) { #>
            <Column SourceColumn="<#=column.Name#>" TargetColumn="<#=column.Name#>" />
            <# } #>
        </Outputs>
    </Lookup>
    <# } #>
        <OleDbDestination Name="Load" ConnectionName="Source" UseFastLoadIfAvailable="false">
            <InputPath OutputPathName="LKP_<#=table.Name#>.Match" />
            <ExternalTableOutput Table="<#=table.SchemaQualifiedName#>" />
        </OleDbDestination>
    </Transformations>
</Dataflow> 

1 个答案:

答案 0 :(得分:0)

你没有提供你的biml所以很难诊断问题,但这是一个有两个查找的工作示例

<Biml xmlns="http://schemas.varigence.com/biml.xsd">
    <Connections>
        <Connection Name="AdventureWorks" ConnectionString="Provider=SQLOLEDB;Data Source=localhost\dev2014;Integrated Security=SSPI;Initial Catalog=AdventureWorks2014" />
    </Connections>
    <Packages>
        <Package Name="LookupDemo" ConstraintMode="Linear">
            <Tasks>
                <Dataflow Name="DFT Sample">
                    <Transformations>
                        <OleDbSource Name="OLE_SRC AW" ConnectionName="AdventureWorks" >
                            <DirectInput>SELECT * FROM (VALUES (N'TRL', 'Turkish Lira'), ('LEI', 'Romania'))D(Code, CurrencyName) cross apply
                                (VALUES (N'XRQ - TRUCK GROUND'),('ZY - EXPRESS')) D1(ShipMethod);</DirectInput>
                        </OleDbSource>

                        <Lookup Name="LKP Purchasing_ShipMethod" NoMatchBehavior="IgnoreFailure" OleDbConnectionName="AdventureWorks">
                          <DirectInput>SELECT
                            SM.ShipMethodID
                        ,   SM.Name
                        ,   SM.ShipBase
                        ,   SM.ShipRate
                        FROM
                            Purchasing.ShipMethod AS SM</DirectInput>
                          <Inputs>
                            <Column SourceColumn="ShipMethod" TargetColumn="Name" />
                          </Inputs>
                          <Outputs>
                            <Column SourceColumn="" TargetColumn="" />
                          </Outputs>
                        </Lookup>
                        <Lookup Name="LKP Sales_Currency" NoMatchBehavior="IgnoreFailure" OleDbConnectionName="AdventureWorks">
                          <DirectInput>SELECT
                            SC.CurrencyCode
                        ,   SC.Name
                        FROM
                            Sales.Currency AS SC;</DirectInput>
                          <Inputs>
                            <Column SourceColumn="Code" TargetColumn="CurrencyCode" />
                          </Inputs>
                          <Outputs>
                            <Column SourceColumn="CurrencyCode" TargetColumn="lkp_CurrencyCode" />
                            <Column SourceColumn="Name" TargetColumn="lkp_Name" />
                          </Outputs>
                        </Lookup>
                        <DerivedColumns Name="DER Placeholder for data viewer" />                       
                    </Transformations>
                </Dataflow>
            </Tasks>
        </Package>
    </Packages>
</Biml>