【发布时间】:2016-03-01 21:38:21
【问题描述】:
我遇到了 Azure 数据工厂和存储过程的问题。
我已将 SP 设置为输入数据的接收器:
"sink": {
"type": "SqlSink",
"sqlWriterStoredProcedureName": "spAddProducts",
"storedProcedureParameters": {
"stringProductData": {
"value": "str1"
}
},
在执行后我必须处理大约 200k 条记录,但是在处理了一些有限数量的行(大约 10k)之后,我得到了错误:
Copy activity met invalid parameters:
ErrorCode=InvalidParameter,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,
Message=The value of the property '' is invalid: 'The SqlParameter is already contained by another
SqlParameterCollection.'.,Source=,''Type=System.ArgumentException,
Message=The SqlParameter is already contained by another SqlParameterCollection.,Source=System.Data,'.
SP 代码:
CREATE PROCEDURE spAddProducts @DimProducts [dbo].[ProductsType] READONLY, @stringProductData varchar(256)
AS
BEGIN
MERGE [dbo].[DimProducts] AS tpr
USING @DimProducts AS spr
ON tpr.ID = spr.ID
WHEN MATCHED AND (tpr.Name <> spr.Name OR tpr.NameInternational <> spr.NameInternational OR tpr.ProductType <> spr.ProductType) THEN
UPDATE SET tpr.Name = spr.Name, tpr.NameInternational = spr.NameInternational, tpr.ProductType = spr.ProductType
WHEN NOT MATCHED THEN
INSERT (Name, NameInternational, ProductType, ID)
VALUES(spr.Name, spr.NameInternational, spr.ProductType, spr.ID)
;
END
【问题讨论】:
-
我注意到您的存储过程没有使用第二个参数 stringProductData。这是必需的吗?
标签: azure stored-procedures azure-data-factory cortana-intelligence