Make Update in local DB after filtering 2 DBs using SQL queries

Hello,

To explain my issue I will give you an example:
I have 2 DBs. (DB1 and DB2)
In UiPath I connect to both using DatabaseConnect activity.
I extract the rows from one table from DB1 in DT1 variable.
I extract the rows from one table from DB2 in DT2 variable.

The ultimate goal is to keep the both DTs updated (DT1 and DT2 have to be same) and I want to do that very fast using Queries.
DT1 is the source.

A method was to TRUNCATE DT2 and INSERT from scratch DT1 in DT2 (for a table with minimum 50k rows…it takes too much)

I have created the final SQL Query which will find the difference between DT1 and DT2 and update in DT2.
My issue: When I try to update DT2 using ExecuteQuery activity, in my query I cannot specify the first DB (DB1) with its table DT1 because that table is not from DB2.
I cannot be connected to both DBs and use one of them to update the other one.

How can I do that?

PS: The processing time is very important otherwise I would have used the TRUNCATE method explained above.

Thank you in advance,
Vlad