|
If it is divided into two places, it is best to transfer the A list to the server where the B list is located.
According to your needs, insert should be enough
--- Copy A to local
select into #A from [....].A
insert B(col1,col2...)
select A.col1,A.col2...
from #A A left join B on A.id = B.id
where B.id is null
For update operations with a large amount of data, if you want to use transactions, remember to do Update first and then Insert, because if the Update goes wrong, the rollback time will be quite long.
If you update a large amount of data, you have to consider the impact of the index on the table on the update efficiency. If you do batches every day and do not affect the business, you can rename table B, and then table B and #A as Union inserts. A table C, rename the table A after rebuilding the index on the table C. |
|