I have a scenario where I need to execute queries on different tables using ETL tool. I want to store all the required queries in control table.
As part of this, I want to include the column WatermarkValue as part of the value in the column Source_Query, so that I can dynamically use it for my execution. This is how my control table should look like.
Table Name: Metadata_Table
| TableID | Source_Query | WatermarkValue |
|---|---|---|
| 1 | select * from dbo.cust_eventchanges where lastmodifieddate >{WatermarkValue} | 2022-10-09T12:00:00 |
| 2 | select * from dbo.cust_contacts where lastmodifieddate >{WatermarkValue} | 2022-07-08T03:20:00 |
So when I run my metadata table like this select * from Metadata_Table where TableID=1
the result should be like below.
select * from dbo.cust_eventchanges where lastmodifieddate >'2022-10-09T12:00:00'
I know we can do this by concatenating two columns. But I would like to know if this is achievable.
I couldn't able to figure out how to achieve this. Hence, I need help on this scenario