0

I have two DB2 databases (Database1 and Database2) both containing a table called SubscriptionTable. Both tables contain user subscription related data and the columns of SubscriptionTable are the same in both databases.

Now I need to copy (and overwrite) data from Database1.SubscriptionTable to Database2.SubscriptionTable but only if the LAST_UPDATED_TIMESTAMP column in Database2.SubscriptionTable is not greater than a specific date.

So in short I would like to overwrite subscription data in Database2.SubscriptionTable but only if the data was NOT modified after a specific date.

Could I use existing utility for this purpose, e.g. db2 import where I could also specify a condition (LAST_UPDATED_TIMESTAMP < 'XXXX-XX-XX') for each row being overwritten ?

4

1 回答 1

1

DB2IMPORT实用程序无法根据行中的内容忽略行。

正如 Gordon Linoff 在评论中所建议的那样,“最简单”的方法是通过联合,因此可以从 Database2 中访问 Database1.SubscriptionTable。

或者,您可以简单地从 Database1 中导出符合您条件的数据:

-- Connect to Database1
export to data.del of del select * from SubscriptionTable 
                           where last_updated_timestamp > ...

-- Connect to Database2
import from data.del of del insert into SubscriptionTable ...
于 2014-07-14T23:04:22.187 回答