I am using Azure Data Factory script to create parameterized SQL query. I understand that the Index specifies the position in which the parameter’s value should go in the SQL command. However, I don’t know how to handle the situation where pipeline().parameters are used multiple times in the SQL query. In my example below, the RUN_DATE parameter is used twice. When I simply add the same parameters multiple times, it will show "Parameters with duplicate name will be overwritten." Any idea how to solve this?
Here is the query:
@concat('
UPDATE s
SET INSERT_DATE = ''', pipeline().parameters.RUN_DATE,'''',
',UPDATE_DATE = ''', pipeline().parameters.RUN_DATE,'''',
'FROM p
WHERE p.ID = s.ID
AND s.ID = ''', pipeline().parameters.ID,'''',
';')
2
Answers
Not sure if I understand the ask 100% here . The scripts which you shared does use the parameter ID and Run_date and since the parameters are accessible through out the lifetime of the pipeline , so even if you do not pass as script parameter , you script will still work fine .
As @Himanshu said, the pipeline parameters can be referred to script directly. I repro’d it with few changes in the script. below is the approach.
Pipeline parameters
RUN_DATE
andID
are taken.Concat function in adf gives the output value as wrapped within double quotes.
To overcome this, script is modified and given as