Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
lebedev
Posting Yak Master
126 Posts |
Posted - 2002-07-18 : 18:45:25
|
| Is there a way to create a clone of the given table. In other words, given a table name, I want to create another table (static table, not a table variable) with a different name, but the same schema.I need to be able to do this in a programmable way using SQL, or T-SQL.thanks. |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2002-07-18 : 19:20:55
|
| SELECT * INTO Table2 FROM Table1Creates a new Table (Table2) from Table1. Only structure and data; indexes and constraints are NOT created. |
 |
|
|
MichaelP
Jedi Yak
2489 Posts |
Posted - 2002-07-18 : 19:21:30
|
| Like this: (This works on PUBS)select a.*into authors2 from authors aMichael<Yoda>Use the Search page you must. Find the answer you will. |
 |
|
|
MichaelP
Jedi Yak
2489 Posts |
Posted - 2002-07-18 : 22:07:46
|
| Sniped by 35 second? wowMichael<Yoda>Use the Search page you must. Find the answer you will. |
 |
|
|
sandesh_moghe
Constraint Violating Yak Guru
310 Posts |
Posted - 2002-07-19 : 03:34:38
|
| One way is there to clone.... Follow the following steps1. Single click on the table which you want to clone (In Enterprise Manager)2. Press Ctrl+ C3. Press Alt+T+Q (This will open Query Analyser)4. Press Ctrl+V in QA5. Press Ctrl+H, Type "TableName" in Find Text box. and "New TableName" in Replace with Text box.6. Press Alt+A7. Press Ctrl+EYes, Thats it..............isnt it simpler way to clone the table. If you practice thrice a day, the you will be master in cloning.....All The Best.---------------------------Sandesh - The Messanger |
 |
|
|
|
|
|