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

Sink stored procedure table name is required

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

但是,对于其中的 2 个,我不断收到以下 Factory Validation Output 错误。

Sink stored procedure table name is required

知道这可能来自哪里吗?

这里是类型和过程:

-- 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 activity:

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

请看我之前的案例: or official example

我也在 github 上开始了关于相同问题的讨论。目前看来是个bug。以下解决方法对我有用。

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

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

该问题现已由 Microsoft 产品团队修复。这是一个错误。