How can we pass parameter to SQL query in Azure data factory ...
ex: Select * from xyz_tbl where date between @date1 and @date2
if I use stored procedure with output @date1 and @date2 parameter, how can I pass these parameter to sql query.
To add parameters to your data flow, click on the blank portion of the data flow canvas to see the general properties. In the settings pane, you will see a tab called Parameter. Select New to generate a new parameter. For each parameter, you must assign a name, select a type, and optionally set a default value.
To get started, open the create/edit Linked Service, and create new parameters for the Server Name and Database Name. Click in the Server Name/Database Name, text box field, and select Add Dynamic Content. Inside the Add dynamic content menu, click on the corresponding parameter you created earlier.
Which version of Azure DataFactory are you using, v1 ir v2?
If v2 is an option for you, you could achieve this by using Lookup activity that queries the database to get your dynamic properties and then referencing that activity's output in your sql query like so:
select * from from xyz_tbl
where date between @{activity('LookupActivity').output.date1}
and @{activity('LookupActivity').output.date2}
Here's a more detailed msdn tutorial for the Lookup activity: https://learn.microsoft.com/en-us/azure/data-factory/control-flow-lookup-activity
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With