If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Informix > How to compy one table from one DB to another

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-17-11, 13:27
fernando guerrero fernando guerrero is offline
Registered User
 
Join Date: Aug 2011
Posts: 10
Question How to compy one table from one DB to another

Hello

I would like to copy the reports2 table located in db1 to reports2 table located in db2.
Both database are in the same Linux machine. I know that there are some commands (load / unload) that I can use to copy the table from one database to the other one. But I don't know how to do it. Do I have to write a shell script and run it? or do I need to be in one of the databases and execute these commands to send the information to the other database?

Any help would be appreciated
Thanks in advance
Reply With Quote
  #2 (permalink)  
Old 08-17-11, 14:40
mjldba mjldba is offline
Registered User
 
Join Date: Dec 2003
Location: North America
Posts: 139
I'm working with IDS 9.4 on an AIX box but I'm sure your LINUX situation is similar. Also, I'm assuming the table in the target database has already been created & is empty.

Using dbaccess, chose the source database (db1) you want to extract data from and execute this:

Unload to "file_name" delimiter "|"
select * reports2;

Change databases & chose the target database (db2) & execute this:

load from "file_name" delimiter "|"
insert into reports2;
Reply With Quote
  #3 (permalink)  
Old 08-17-11, 15:28
fernando guerrero fernando guerrero is offline
Registered User
 
Join Date: Aug 2011
Posts: 10
thanks a lot mjldba

Last edited by fernando guerrero; 08-17-11 at 15:56.
Reply With Quote
  #4 (permalink)  
Old 08-25-11, 06:02
rgomezs rgomezs is offline
Registered User
 
Join Date: Oct 2007
Posts: 4
Hi.

Another way to do the same could be this SQL:

insert into bd2:table select * from bd1:table;

Where bd1 is the source database and bd2 is the target database. It´s suposed you´ve created the table structure in bd2.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On