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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 Clone table structure

Author  Topic 

scmay
Starting Member

22 Posts

Posted - 2007-07-20 : 00:23:33
Is there a way to clone a table in a database without writing scripts with 'CREATE TABLE ...' as there are too many columns in that table. I need to clone the structure of a table in order to archive data but writing scripts to create that archive table is not efficient.

Don't want to create a clone via Designer view either.

Any ideas?

dinakar
Master Smack Fu Yak Hacker

2507 Posts

Posted - 2007-07-20 : 00:33:23
Try
SELECT * INTO CloneTable FROM OriginalTable WHERE 0=1


This will ONLY create the structure. Any PK/FK/Indexes etc have to be added manually.

Dinakar Nethi
************************
Life is short. Enjoy it.
************************
http://weblogs.sqlteam.com/dinakar/
Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-07-20 : 11:04:33
You can let sql generate script for you in em.
Go to Top of Page
   

- Advertisement -