Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to duplicate a table

Status
Not open for further replies.

dndaughtery

Programmer
Jan 25, 2006
67
US
How can I duplicate a table using SQL in the Query analyzer?
 
Right Click the table you want to Duplicate in Enterprise manager, select tasks and then generate script. Copy the code generated and place it in Query Analyzer.
 
IF you want the data with the same table structure you can use

Select *
Into <new table>
From <orig table>
 
Aboslutely Dennis, that's why Iasked what the poster meant by duplicate. Because the answer is different depending on the need.

And for the record selct into will not work if you run a script to create the table first. Then you must use an insert statement to get the data.

Questions about posting. See faq183-874
Click here to help with Hurricane Relief
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top