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
 General SQL Server Forums
 New to SQL Server Programming
 How to Create a new table from Existing Table

Author  Topic 

bharatagraj
Starting Member

6 Posts

Posted - 2005-08-19 : 12:31:08
Hi All I want to create new table which is going to be a copy of one existing table.
I need to copy the existing data into the new table too. How do I do that?

mwjdavidson
Aged Yak Warrior

735 Posts

Posted - 2005-08-19 : 12:48:25
Hi
You can do
SELECT *
INTO MyNewTable
FROM MyTable



Mark
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2005-08-19 : 13:18:35
That does not however copy any indexes, primary keys or any contraints..if you need those you'll have to script the table from Enterprise Manager...



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx
Go to Top of Page
   

- Advertisement -