Share via

read rows from a table

arkiboys 9,711 Reputation points
2021-09-07T14:30:39.413+00:00

Hello,
I have a table in sql server on prem called dbo.TableNames
There are three rows:
ID TableName
1 table1
2 table2
3 table3

I would like to loop through the dbo.TableNames table and copy into sink...

At present, I have a copy activity which takes a parameter, pEntityName and then depending on which table name I physically type in there, it copies from source(on prem sql) to sink. This bit is fine.
The question I have is how to read each table inside dbo.TableNames and pass each tableName into the copy activity pEntityName parameter?

Thank you

Azure Data Factory
Azure Data Factory

An Azure service for ingesting, preparing, and transforming data at scale.

0 comments No comments

Answer accepted by question author

HimanshuSinha 19,637 Reputation points Microsoft Employee Moderator
2021-09-07T23:29:16.893+00:00

Hello @arkiboys ,
Thanks for the ask and using the Microsoft Q&A platform .
As I understand your pipeline is already parameterized and so all you need to do is

  1. Create a pipeline .
    2.Add a lookup activity and read the table content with a query , eg

select* from dbo.TableNames .

  1. Add a foreach activity and inside that add execute pipeline
    and then pass the a dynamic expression as the parameter .

@activity('Get the table name and Scheman Name').output.value

I have a slightly different implementation , sharing the animation HTH .

130025-copymultipletable.gif

Please do let me know how it goes .
Thanks
Himanshu
Please do consider clicking on "Accept Answer" and "Up-vote" on the post that helps you, as it can be beneficial to other community members

Was this answer helpful?

0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.