x
login about faq Site discussion (meta-askssc)

Can we copy a table as another table?

I want to copy a table as another table. Like copying a document in windows.

Is it possible?

I have a scenario where I need to create 5 tables similar to existing table. The only change is table name and adding some prefix text to existing columns.

Is there any simple way we can do this?

more ▼

asked Dec 15 '09 at 03:11 PM in Default

OraLearner gravatar image

OraLearner
1.3k 51 66 83

(comments are locked)
10|1200 characters needed characters left

1 answer: sort newest

Check out the 'CREATE TABLE AS SELECT' syntax. You can build a table based on the results of a SELECT statement.

more ▼

answered Dec 15 '09 at 03:31 PM

HillbillyToad gravatar image

HillbillyToad
1k 2

Thank you very much. This reduced lot of my work. I found the required link here - http://www.oracle-training.cc/t_garmany_easyoracle_create_table_as_select.htm

Dec 15 '09 at 03:53 PM OraLearner

It's one of my FAVORITE SQL tricks, and way less overhead than manually populating a table with multiple INSERTS.

Dec 15 '09 at 04:02 PM HillbillyToad

I guess.. this would be my favourite too now onwards :)

Dec 15 '09 at 04:30 PM OraLearner
(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments



Facebook logo Follow Ask SSC on Facebook
Find Ask SSC on Google+
linkedin logo Find us on LinkedIn

Topics:

x359
x76

asked: Dec 15 '09 at 03:11 PM

Seen: 466 times

Last Updated: Dec 15 '09 at 03:11 PM

Copyright © 2002-2012 Simple Talk Publishing. All Rights Reserved. If you have any queries, please contact the site administrators.
Ask SQL Server Central is a community service provided by Red Gate.