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 Development (2000)
 copy table in the same datebese

Author  Topic 

mimic
Starting Member

18 Posts

Posted - 2008-01-08 : 08:03:51
Hi!

I'd like to copy table in the same database becouse i'd like to test something.

So i'd like to copy table A with all constrains and indexes to another new table B with all the data.
Then i have a backup of a table A.
If something goes wrong with my table A when i modify that table, then i would like to delete table A, and then use table B and recreate table A back again.

How can i do that?

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-01-08 : 08:33:51
1 Script out the required tables
2 Rename the table names and run the script
3 Insert into new_table(columns) select columns from source_table
4 Do manipulation on source_table

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2008-01-08 : 23:04:08
Or copy with dts.
Go to Top of Page
   

- Advertisement -