Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Duplicate table

Posted on 2011-09-07
3
Medium Priority
?
195 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 21

Accepted Solution

by:
JestersGrind earned 668 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 664 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 668 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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

I have written a PowerShell script to "walk" the security structure of each SQL instance to find:         Each Login (Windows or SQL)             * Its Server Roles             * Every database to which the login is mapped             * The associated "Database User" for this …
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

618 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