Typically, when you want to reference tables in dbnew from dbold or vice versa, you must "link" the databases. For example, Oracle provides functionality to LINK two databases as follows: Let's assume we want to link dbNew to dbOld...
Assuming we are logged onto dbOld...
CREATE DATABASE LINK linkname
CONNECT TO username IDENTIFIED BY password
USING dbNew
(This assumes that dbNew is the name the database is known by.)
Once this link has been established, then all tables/views/data of dbNew are now available in dbOld, and you reference them as such:
SELECT fieldname FROM tablename@linkname;
the "@" followed by linkname that you provide tells the database that you want to access the linked database.
Once you establish this sort of linking, you can then easily implement inserts from one table to another via SQL.
Other database engines apply similar principles.
|