0
votes

I've got problem with Azure Data Factory and Stored Procedure.

I've set SP as sink for input data:

"sink": {
                        "type": "SqlSink",
                "sqlWriterStoredProcedureName": "spAddProducts",
                    "storedProcedureParameters": {
                        "stringProductData": {
                            "value": "str1"
                        }
                    },

and after execution I've got to process about 200k records, but after some limited number of processed rows (about 10k), I've got error:

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

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
1
I noticed your stored proc doesn't user the 2nd parameter, stringProductData. Is this required?AlvinfromDiaspar

1 Answers

1
votes

I'm from the product team. We identified the issue and the fix has been deployed last week. Thanks for reporting the defect.