Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2011
    Posts
    10

    Question Unanswered: 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

  2. #2
    Join Date
    Dec 2003
    Location
    North America
    Posts
    146
    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;

  3. #3
    Join Date
    Aug 2011
    Posts
    10
    thanks a lot mjldba
    Last edited by fernando guerrero; 08-17-11 at 16:56.

  4. #4
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •