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

Creating a duplicate table like existing


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

New User


Joined: 24 Jul 2007
Posts: 38
Location: Bangalore

PostPosted: Mon Sep 03, 2007 4:41 pm
Reply with quote

Hi,

I want to create a duplicated table.
I am having a table "TABLE1" and i need to create another table "TABLE2" with all the records in the "TABLE1".

I think this can be done using Load and unload utilities.
Please let me know if there is any other method.

Thanks all!!!
Back to top
View user's profile Send private message
Prajesh_v_p

Active User


Joined: 24 May 2006
Posts: 133
Location: India

PostPosted: Mon Sep 03, 2007 5:10 pm
Reply with quote

If you have QMF and then the number of records are only a few..

you could use select * from TABLE1 in qmf panel and you can issue the command 'save data as TABLE2' (Note that table2 will be created under your id only).

Thanks,
Prajesh
Back to top
View user's profile Send private message
Bhagyalakshmi C

New User


Joined: 24 Jul 2007
Posts: 38
Location: Bangalore

PostPosted: Mon Sep 03, 2007 5:19 pm
Reply with quote

you can issue the command 'save data as TABLE2'

Where i have give this??

Thanks!!!!
Back to top
View user's profile Send private message
Prajesh_v_p

Active User


Joined: 24 May 2006
Posts: 133
Location: India

PostPosted: Mon Sep 03, 2007 5:22 pm
Reply with quote

Give it in QMF command line...
Back to top
View user's profile Send private message
Bhagyalakshmi C

New User


Joined: 24 Jul 2007
Posts: 38
Location: Bangalore

PostPosted: Mon Sep 03, 2007 5:23 pm
Reply with quote

should it be like this

Code:

select * from table1 save data as table2


this is not working getting error!!!
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Mon Sep 03, 2007 5:27 pm
Reply with quote

As an answer to interview question-
Code:
1. CREATE TABLE2 LIKE TABLE1
2. INSERT INTO TABLE2 (SELECT * FROM TABLE1)
Back to top
View user's profile Send private message
Prajesh_v_p

Active User


Joined: 24 May 2006
Posts: 133
Location: India

PostPosted: Mon Sep 03, 2007 5:28 pm
Reply with quote

select * from table1
in the query panel..then execute the query...after that issue command "save data as table2" in QMF command line..

Thanks,
Prajesh
Back to top
View user's profile Send private message
Bhagyalakshmi C

New User


Joined: 24 Jul 2007
Posts: 38
Location: Bangalore

PostPosted: Tue Sep 04, 2007 11:28 am
Reply with quote

Thanks Prajesh..

I got it!!

icon_smile.gif

Thank you!!
Back to top
View user's profile Send private message
Bhagyalakshmi C

New User


Joined: 24 Jul 2007
Posts: 38
Location: Bangalore

PostPosted: Tue Sep 04, 2007 11:38 am
Reply with quote

Thanks Abhijit!!!!

Quote:

As an answer to interview question-
Code:
1. CREATE TABLE2 LIKE TABLE1
2. INSERT INTO TABLE2 (SELECT * FROM TABLE1)


This is not working!!
can you please explain me!!!

Thank you!!!
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Tue Sep 04, 2007 11:48 am
Reply with quote

!!! icon_confused.gif
Explain you what?

Only 'This is not working!! ' does not tell me anything about problem you got in your query. Please explain your problem..
Back to top
View user's profile Send private message
karnataka

New User


Joined: 15 Sep 2006
Posts: 20
Location: bangalore

PostPosted: Thu Sep 06, 2007 11:43 am
Reply with quote

Hi,

r u trying to execute both queries at a time in QMF?
Back to top
View user's profile Send private message
karnataka

New User


Joined: 15 Sep 2006
Posts: 20
Location: bangalore

PostPosted: Thu Sep 06, 2007 11:43 am
Reply with quote

Hi,

r u trying to execute both queries at a time in QMF?
Back to top
View user's profile Send private message
Bhagyalakshmi C

New User


Joined: 24 Jul 2007
Posts: 38
Location: Bangalore

PostPosted: Thu Sep 06, 2007 4:14 pm
Reply with quote

Hi,

No.. not at the same time..one after the other only..

It should be..

CREATE TABLE TABLE2 LIKE TABLE1

the "TABLE" key word is missing.. so did not get..

any way the second query i am not getting..

Thank you!!!
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Fri Sep 07, 2007 5:10 pm
Reply with quote

Quote:
any way the second query i am not getting

You haven't understood or
dies it mean you are not getting any error?
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 Duplicate transid's declared using CEDA CICS 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