Hello, I am trying to retrieve data from multiple tables (around 30 tables) in MS SQL server and check for different dates. Those tables have the same alias (timestamp) like _20230612 is same for every single table.
For example, the input tables (30) are like below and will be union together for checking.
Staging_A_20230612
Staging_B_20230612
Staging_C_20230612
Staging_D_20230612
Since I need to update the table alias (_20230612) for each checking and I have tons of table to update, is anyone knowing how to update the timestamp once and have all my 30 table names updated So I don't have to update all the table names manually each time. Thank you so much!
for example I input 20230611 then all my input get updated to:
Staging_A_20230611
Staging_B_20230611
Staging_C_20230611
Stagng_D_20230611
Solved! Go to Solution.
Here's what I would do:
outer workflow:
1) Follow @SeanAdams 's advice on grabbing MS SQL tables here:
2) filter for your tablenames that you want.
macro:
3) create a macro with a text input containing a base query and your connection name.
4) attach the macro to your dynamic input in-DB tool.
5) use a formula tool to adjust your timestamp logic.
6) use a write in-db tool to write back to MS SQL.
7) turn your macro into a batch macro and use a control parameter/action tool combo to update your base table in your query in your text input tool.
outer workflow:
8) in your outer workflow - bring your macro onto your canvas.
9) connect your table names to your control parameter.