x

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, 2009 at 03:11 PM in Default

OraLearner gravatar image

OraLearner
1.3k 77 86 88

(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, 2009 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, 2009 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, 2009 at 04:02 PM HillbillyToad
I guess.. this would be my favourite too now onwards :)
Dec 15, 2009 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.

New code box

There's a new way to format code on the site - the red speech bubble logo will automatically format T-SQL for you. The original code box is still there for XML, etc. More details here.

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

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x378
x84

asked: Dec 15, 2009 at 03:11 PM

Seen: 869 times

Last Updated: Dec 15, 2009 at 03:11 PM