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
 Old Forums
 CLOSED - General SQL Server
 Duplicate table

Author  Topic 

smily
Starting Member

25 Posts

Posted - 2002-03-11 : 10:06:26
Hi Guys,

Can anyone explain me...how to duplicate a table in enterprise manager?

Smily

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-03-11 : 10:10:03
The easiest way would be to run the Import/Export DTS Wizard. It will walk you through the possible steps.

It's actually easier to do this in query analyzer/T-SQL, using the SELECT...INTO syntax:

SELECT * INTO Table2 FROM Table1

This will copy the data, but it won't preserve indexes or constraints. It is also a performance hog if you have large tables.

Go to Top of Page

smily
Starting Member

25 Posts

Posted - 2002-03-11 : 10:19:44
Quick response, but will copy only the data of the table,
I need including the field names

It is possible with q-analyzer?

Pauline

Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-03-11 : 10:23:33
Yes, everything about the table is copied except indexes and constraints.

Go to Top of Page

Nazim
A custom title

1408 Posts

Posted - 2002-03-11 : 10:23:40
smily , i think u r new to sql server.

it first copy's the structure of the table and then copies the data.

you cannot hold any data in a relational database without a field.

When you exectute this , table2 will have the same schema (field's with same datatypes and name) with the data

SELECT * INTO Table2 FROM Table1

HTH

--------------------------------------------------------------
Go to Top of Page

smily
Starting Member

25 Posts

Posted - 2002-03-11 : 10:44:27
Yep, I can realize how thick I am? without thinking of that!!:)

Yes I am a newbbie for SQL:)


Thanks a lot guys!!!

Smily




Go to Top of Page

smily
Starting Member

25 Posts

Posted - 2002-03-11 : 11:22:31
quote:

smily , i think u r new to sql server.

it first copy's the structure of the table and then copies the data.

you cannot hold any data in a relational database without a field.

When you exectute this , table2 will have the same schema (field's with same datatypes and name) with the data

SELECT * INTO Table2 FROM Table1

HTH

--------------------------------------------------------------





Sorry it is not helping me!

It gives some kine of ODBC weired error!

Smily

Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-03-11 : 11:32:45
You'll have to post your exact SQL statement and the EXACT error message.

Go to Top of Page

smily
Starting Member

25 Posts

Posted - 2002-03-11 : 11:46:12
No Problem Robvolk,

I created new tables with sql diagram.

thanks for ur help!

Smily

Go to Top of Page
   

- Advertisement -