1.We can store the sql queries in the sql table.
2.We use Execute SQL Task to get the SqlQuery column. Then store the sql queries in the object variable.
3.We can use Foreach Loop Container to read each sql query that stored in the object variable. Then store the sql query in the string variable.
4.We can set DataAccessMode as SQL command from variable in the OLEDB source editor.
5.We can add a Flat File Destination.
Hope the following link will be helpful:
Using SSIS packages to add row headers and data into flat files
Best Regards,
Mona
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.