Solved

Duplicate table

Posted on 2011-09-07
3
188 Views
Last Modified: 2012-05-12
I need to create a duplicate of a table I already have.
How do I do that? Do I need to create first a new table or can that be done automatically?
0
Comment
Question by:johnkainn
3 Comments
 
LVL 21

Accepted Solution

by:
JestersGrind earned 167 total points
ID: 36495641
In Object Explorer, right-click on the table and select Script Table as --> CREATE To --> New Query Editor window.  Then edit the script to change the table names.  Run the script.

Greg
0
 
LVL 5

Assisted Solution

by:zvytas
zvytas earned 166 total points
ID: 36495645
You can achieve the desired result by issuing the following SQL statement:

SELECT *
INTO NewTable1
FROM Table1
0
 
LVL 14

Assisted Solution

by:Christopher Gordon
Christopher Gordon earned 167 total points
ID: 36495786
I usually use the Import / Export wizard (right click on database in Management Studio).  This will create the destination table and populate with data.  It will not move indexes/constraints.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Problem with SQL Script - Cannot call methods on char 2 26
Text file into sql server 5 32
SQL trigger 5 23
What is this datetime? 1 19
     When we have to pass multiple rows of data to SQL Server, the developers either have to send one row at a time or come up with other workarounds to meet requirements like using XML to pass data, which is complex and tedious to use. There is a …
Naughty Me. While I was changing the database name from DB1 to DB_PROD1 (yep it's not real database name ^v^), I changed the database name and notified my application fellows that I did it. They turn on the application, and everything is working. A …
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

837 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question