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 > DB2 > Copying a DB2 table to another server programmatically

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-07-06, 17:15
bbresc512 bbresc512 is offline
Registered User
 
Join Date: Mar 2006
Posts: 1
Copying a DB2 table to another server programmatically

Hi
what is the best way to copy a DB2 table to another server (DB2 too for a start) programmatically? I did some research on CLI, it is pretty easy to copy a table inside the same server, like:
insert into table2 select * from table1

but I couldn't find anything except for manually fetching record by record and inserting it to the destination table.

Thanks in advance
Reply With Quote
  #2 (permalink)  
Old 03-07-06, 19:48
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
Look at Federation ... You can refer to remote tables as nicknames and copy the data across using Cursor Load

Say you want to copy data from table t10 in db test1db to t100 in db test2db ..

In test2db, define test1db's t10 as nickname -- say test1db.t10

declare c1 cursor for select * from test1db.t10
load from c1 of cursor insert into t100
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
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