接收器存储过程表名称为必填项

时间:2019-08-12 14:39:58

标签: azure-sql-database azure-data-factory

我正在将数据从SQL表复制到另一个表。接收器具有一个存储过程,其中完成了SQL合并。该存储过程已经过直接测试,我可以确认它是否有效。我也有几个具有相同逻辑的不同复制活动。

但是,对于其中的2个,我仍然遇到以下Factory Validation Output错误。

  

需要接收器存储过程表名称

有人知道这可能来自哪里吗?

这里的类型和过程:

-- create type
create type [sta].[my_type] as table (
    [column1] [nvarchar](255) null,
    [column2] [nvarchar](255) null,
    [column3] [nvarchar](255) null,
    [column4] [nvarchar](255) null,
    [column5] [nvarchar](255) null,
    [column6] [nvarchar](255) null
)
GO

-- create procedure
create procedure [cdw].[sp_load_table] 
    @mytable [sta].[my_type] readonly
as
begin
    merge [cdw].[mytable] as target
    -- handle duplicates
    using (select distinct * from @mytable) as source
    on (target.[column1] = source.[column1]
        and target.[column2] = source.[column2]
        and target.[column3] = source.[column3]
        and target.[column4] = source.[column4]
        and target.[column5] = source.[column5]
        and target.[column6] = source.[column6])

    when matched and (
           COALESCE(target.[column1], 1) <> COALESCE(source.[column1], 1)
        or COALESCE(target.[column2], 1) <> COALESCE(source.[column2], 1)
        or COALESCE(target.[column3], 1) <> COALESCE(source.[column3], 1)
        or COALESCE(target.[column4], 1) <> COALESCE(source.[column4], 1)
        or COALESCE(target.[column5], 1) <> COALESCE(source.[column5], 1)
        or COALESCE(target.[column6], 1) <> COALESCE(source.[column6], 1)) then

        update 
            set target.[column1] = source.[column1],
                target.[column2] = source.[column2],
                target.[column3] = source.[column3],
                target.[column4] = source.[column4],
                target.[column5] = source.[column5],
                target.[column6] = source.[column6]

    when not matched by target
       then 
          insert ([column1], [column2], [column3], [column4], [column5], [column6])
          values (source.[column1], source.[column2], source.[column3],
                  source.[column4], source.[column5], source.[column6])

    when not matched by source
        then delete;     
end

这里是ADF活动:

image

2 个答案:

答案 0 :(得分:0)

我也开始在github上讨论相同的问题。目前似乎是一个错误。以下变通办法对我有用。

关注有关Github的讨论以获取更多信息:

Github链接:github.com/MicrosoftDocs/azure-docs/issues/36916

enter image description here

Microsoft产品团队现已解决了该问题。这是一个错误。

答案 1 :(得分:-1)

也许您可以尝试调整表类型的值,将[sta].[my_type]替换为my_type

请查看我以前的情况:Azure Data Factory mapping 2 columns in one columnofficial example

enter image description here