IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Way to physically move the rows from one table to another


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
theone1987

New User


Joined: 14 Sep 2009
Posts: 60
Location: Milan

PostPosted: Wed Mar 17, 2010 4:52 pm
Reply with quote

maybe I'm about to say something stupid ... but ...
is a way to physically move the rows from one table to another? (the tables have the same fields, declared the same way, are practically identical)

thanks ...
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Wed Mar 17, 2010 6:08 pm
Reply with quote

Does this help?
Back to top
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1020
Location: India

PostPosted: Wed Mar 17, 2010 6:32 pm
Reply with quote

theone,

there are lot of ways(your imagination limits it).
1.
Code:
insert into table2
select * from table1;

delete from table1;


2.
UNLOAD from table1
LOAD table2 (REPLACE or RESUME) based on your need

dummy load on table1

3. My favourite, not tested yet.
Code:
RENAME TABLE table1 to table10
RENAME TABLE table2 to table1
RENAME TABLE table10 to table2


there are no stupid questions,
Sushanth
Back to top
View user's profile Send private message
theone1987

New User


Joined: 14 Sep 2009
Posts: 60
Location: Milan

PostPosted: Wed Mar 17, 2010 7:42 pm
Reply with quote

sushanth bobby wrote:

But i dont want to delete all table 1...
for example

table 1
a
b
c

table 2
empty

after the command the situation will be:
table 1
a

table 2
b
c

(is a way to not do the delete in table 1? because it contains a lot of rows ...)
Back to top
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1020
Location: India

PostPosted: Wed Mar 17, 2010 8:42 pm
Reply with quote

theone,
Use
Code:
insert into table2
select * from table1 where YOURCONDITIONS;

delete from table1 where YOURCONDITIONS;



Sushanth
Back to top
View user's profile Send private message
theone1987

New User


Joined: 14 Sep 2009
Posts: 60
Location: Milan

PostPosted: Wed Mar 17, 2010 9:00 pm
Reply with quote

do you know anything about EXCHANGE DATA?
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Mar 17, 2010 9:53 pm
Reply with quote

Hello,

This does not look like what you are asking for. . .
Read here:
publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/handheld/Connected/BOOKS/dsnsqk10/5.61
Back to top
View user's profile Send private message
manikawnth

New User


Joined: 07 Feb 2007
Posts: 61
Location: Mumbai

PostPosted: Thu Mar 18, 2010 1:46 pm
Reply with quote

If you want to physically move the data,
Take each row from the source table.
Carefully pack it and courier it to the target table.
If possible call/ping it once to make sure that the parcel is received.

Just kidding,
May be you are not asking what you are expecting.
Kindly post your requirement/problem instead of asking the possibility of a function in it.

If the question is much clear
the answer will be much near.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Mar 18, 2010 7:43 pm
Reply with quote

Hello,

Quote:
Kindly post your requirement/problem instead of asking the possibility of a function in it.

Please read the entire topic. . .

The requirement seems to be quite clear. . .

And the way to accomplish it is clear also. . . Just not work-free enough?
Back to top
View user's profile Send private message
manikawnth

New User


Joined: 07 Feb 2007
Posts: 61
Location: Mumbai

PostPosted: Fri Mar 19, 2010 10:47 am
Reply with quote

Hi Dick,
My idea is that,
Physically move something implies to database organization, where the two databases have the identical stogroup.
I quoted the statement in that sense.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Load new table with Old unload - DB2 DB2 6
No new posts To get the count of rows for every 1 ... DB2 3
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Multiple table unload using INZUTILB DB2 2
No new posts Check data with Exception Table DB2 0
Search our Forums:

Back to Top