Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Creating a duplicate table like existing

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: Creating a duplicate table like existing
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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: 686
Location: Earth

PostPosted: Mon Sep 03, 2007 5:27 pm    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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: 686
Location: Earth

PostPosted: Tue Sep 04, 2007 11:48 am    Post subject:
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    Post subject: Reply to: Creating a duplicate table like existing
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    Post subject: Reply to: Creating a duplicate table like existing
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    Post subject:
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: 686
Location: Earth

PostPosted: Fri Sep 07, 2007 5:10 pm    Post subject:
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    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 Insert a Row_number into table useit DB2 2 Tue Sep 19, 2017 1:07 pm
No new posts how to see when the last read access ... Mike 1304 DB2 1 Tue Sep 12, 2017 7:52 pm
No new posts Creating ISPF Screens with Scrname vi... Albireo20 TSO/ISPF 9 Tue Sep 05, 2017 4:24 pm
No new posts PC (UTF-8) -> z/OS (EBCDIC) -> ... prino All Other Mainframe Topics 4 Fri Sep 01, 2017 1:47 am
No new posts Adding a userid to SMTP Security table Yolanda Harvey JCL & VSAM 1 Sun Aug 13, 2017 6:16 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us