Unanswered: Newbie: How to pass data from database to other database
Hi guys im new in the informix world, i need to pass data from a table X in database A, to a table Y in database B, the fields are not equal so i need to do an insert (fields...) values(..)
i thought in write a stored procedure but i don't have a manual to learn (is difficult to find informix manuals ), how can i pass this data using just a SQL query or stored procedure?
If your second database is on the same databaseserver you can use :
insert into table1 (col1, .. ) select col2,.. from db2:tab2 ;
If your second database is on another databaseserver (same or other hosts) you can use :
insert into table (col1, ..) select col2,.. from db2@server2:tab2 ;
and be sure your server2 is also referenced in the SQLhosts file your pointing at.
Another way is to unload from a specific select statement with : unload to 'file1' select col1, .. from tab1;
Move the file and reload them on the second database :
load from 'file' insert into tab2.