How to pass ADF parameter values or System Function values as input parameter to a Stored Procedure that is dynamically invoked based on pipeline parameter based on an input json metadata?

George, Nitin Mathew 25 Reputation points
2024-01-02T09:54:00.87+00:00

As per this URL one can invoke any SP dynamically by passing any parameters. But the challenge is when you want to pass on a ADF system variable or value from any other ADF variable/parameter to the dynamically fed in Input parameter of SPs, there is a challenge. I tried the below but it wasn't recognized by ADF.

Injected MetaData to argument- 'storedProcedureParameters'

{
    "ParamText": {
        "value": "HardcodedValue",
        "type": "String"
    },
    "ParamDate": {
        "value": {
            "value": "@pipeline().TriggerTime",
            "type": "Expression"
        }
        "type": "Datetime"
    }
}

Error:

Operation on target Execute Stored Procedure failed: ErrorCode=UserErrorInvalidParameterInStoredProcedure,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=The value of the property 'Value' is invalid for the stored procedure parameter '<Parameter>'.,Source=Microsoft.DataTransfer.ClientLibrary,''Type=System.Exception,Message=System.Collections.Generic.Dictionary`2[System.String,System.Object] is not a valid value for <DataType>.,Source=System,''Type=System.FormatException,Message=Input string was not in a correct format.,Source=mscorlib,'

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,917 questions
Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
9,773 questions
{count} votes

Accepted answer
  1. phemanth 6,810 Reputation points Microsoft Vendor
    2024-01-17T07:56:48.8+00:00

    @George, Nitin Mathew
    Hi

    I apologize for inconvenience actually I communicated with internal team person.

    we tried from our end and found in your case it is not possible to pass expression in JSON dynamically ADF does not consider expression as expression it considers as string so it will end up with error. 

    It is a limitation. User's image

    i see you use lookup activity. To sort this, you can pass the actual value instead of expression. you should do by adding set variable activity it before lookup activity and pass inside the set variable activity.

    Or else

    if you want to pass expression you should follow the regular approach as show in picture belowUser's image

    Hope this helps. Do let us know if you any further queries.


0 additional answers

Sort by: Most helpful