Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Way to physically move the rows from one table to another

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: Way to physically move the rows from one table to another
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

Senior Member


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

PostPosted: Wed Mar 17, 2010 6:08 pm    Post subject:
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: 1013
Location: India

PostPosted: Wed Mar 17, 2010 6:32 pm    Post subject:
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    Post subject:
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: 1013
Location: India

PostPosted: Wed Mar 17, 2010 8:42 pm    Post subject:
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    Post subject:
Reply with quote

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

Site Director


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

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

Hello,

This does not look like what you are asking for. . .
Read here:
http://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    Post subject: @theone
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

Site Director


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

PostPosted: Thu Mar 18, 2010 7:43 pm    Post subject:
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    Post subject: @Dick
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts DB2 query Using Recursion, Converting... smilewithashu2 DB2 1 Tue Jan 03, 2017 12:50 pm
No new posts SQL query to run through list of valu... Ni3-db2 DB2 14 Wed Dec 14, 2016 9:52 am
This topic is locked: you cannot edit posts or make replies. How to move a long alphanumeric data ... lind sh COBOL Programming 8 Mon Dec 05, 2016 7:51 pm
This topic is locked: you cannot edit posts or make replies. Db2 SQL query to convert rows into co... subratarec DB2 5 Thu Nov 17, 2016 4:51 pm
No new posts Row-Numbers of distinct rows? Auryn DB2 1 Thu Oct 20, 2016 4:38 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us