You have 2 options to achieve your desired output :
Option 1: Use ADF Parameters
- Create a Parameter in ADF:
- Go to the pipeline where your Copy Activity is located.
- Click on the "Parameters" tab.
- Create a new parameter, e.g.,
dateParam
.
- Pass the Parameter to the Copy Activity:
- In the Copy Activity, go to the "Source" tab.
- Use dynamic content to inject the parameter into your SQL query.
SELECT * FROM table1 WHERE date1 = '@{pipeline().parameters.dateParam}'
When you run the pipeline, you can provide the date value for dateParam
.
Option 2: Use Stored Procedure
If you want to keep the SQL logic intact (including the use of variables), you could use a stored procedure:
- Create a Stored Procedure in Your SQL Database:
CREATE PROCEDURE GetTable1Data @dateParam DATE AS BEGIN SELECT * FROM table1 WHERE date1 = @dateParam END
- Call the Stored Procedure from ADF:
- In ADF, use the "Stored Procedure" activity or pass the parameters in the SQL query as follows:
EXEC GetTable1Data @dateParam = '@{pipeline().parameters.dateParam}'