473,785 Members | 2,746 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Create a copy of a table in sql server

I have a table I'd like to copy so I can edit it and play around with
the data. How do I create copy of a table in SQl Server?

Thanks,

Bill
Jul 20 '05 #1
5 295555
The easiest method to copy a table with data is SELECT ... INTO:

SELECT *
INTO MyNewTable
FROM MyTable

Note that this method does not copy constraints and indexes.

--
Hope this helps.

Dan Guzman
SQL Server MVP

-----------------------
SQL FAQ links (courtesy Neil Pike):

http://www.ntfaq.com/Articles/Index....partmentID=800
http://www.sqlserverfaq.com
http://www.mssqlserver.com/faq
-----------------------

"Bill" <bi***********@ gospellight.com > wrote in message
news:8d******** *************** ***@posting.goo gle.com...
I have a table I'd like to copy so I can edit it and play around with
the data. How do I create copy of a table in SQl Server?

Thanks,

Bill

Jul 20 '05 #2
Hi

I suggest that you backup the database and restore it as a different
database.

See the following (for move read copy!):

http://support.microsoft.com/default...n-us;Q314546#2

John

"Bill" <bi***********@ gospellight.com > wrote in message
news:8d******** *************** ***@posting.goo gle.com...
I have a table I'd like to copy so I can edit it and play around with
the data. How do I create copy of a table in SQl Server?

Thanks,

Bill

Jul 20 '05 #3
Isn't that overkill? You'll not only copy the table, but you'll copy
everything else in that database as well!!!!

Thanks,
Brian

John Bell wrote:

Hi

I suggest that you backup the database and restore it as a different
database.

See the following (for move read copy!):

http://support.microsoft.com/default...n-us;Q314546#2

John

"Bill" <bi***********@ gospellight.com > wrote in message
news:8d******** *************** ***@posting.goo gle.com...
I have a table I'd like to copy so I can edit it and play around with
the data. How do I create copy of a table in SQl Server?

Thanks,

Bill


--
=============== =============== =============== =============== =======

Brian Peasland
dba@remove_spam .peasland.com

Remove the "remove_spa m." from the email address to email me.
"I can give it to you cheap, quick, and good. Now pick two out of
the three"
Jul 20 '05 #4
if you're moving it from one database to another on the same server, i
would use DTS and "copy object." if you're moving it to another
server this method will sometimes fail.

i'm not sure but i think it has something to do with object
permissions granted to logins that exist on the source server but do
not exist on the destination server. if it's all on the same server
it's a non-issue. i'm pretty sure this will also bring over your
indexes, constraints, etc.
Jul 20 '05 #5
When playing mistakes can be made!

John

"Brian Peasland" <dba@remove_spa m.peasland.com> wrote in message
news:3F1E8D4A.D 0B2AB56@remove_ spam.peasland.c om...
Isn't that overkill? You'll not only copy the table, but you'll copy
everything else in that database as well!!!!

Thanks,
Brian

John Bell wrote:

Hi

I suggest that you backup the database and restore it as a different
database.

See the following (for move read copy!):

http://support.microsoft.com/default...n-us;Q314546#2

John

"Bill" <bi***********@ gospellight.com > wrote in message
news:8d******** *************** ***@posting.goo gle.com...
I have a table I'd like to copy so I can edit it and play around with
the data. How do I create copy of a table in SQl Server?

Thanks,

Bill


--
=============== =============== =============== =============== =======

Brian Peasland
dba@remove_spam .peasland.com

Remove the "remove_spa m." from the email address to email me.
"I can give it to you cheap, quick, and good. Now pick two out of
the three"

Jul 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
4284
by: Cyril | last post by:
Hello, I need to copy a table from an 8i oracle database to a sqlserver 2000 database. Is it possible to use the command "COPY FROM ... TO ..." ? So, what is the correct syntax ? Thanks for your help
1
3362
by: poohnie08 | last post by:
i have a excel spreadsheet showing staff name, date,work hour, ot hour, slot1, slot2, slot3, slot4 and others). The "()" will keep repeating from day 1 until end of month. eg in excel spreadsheet, ============================================================================== A1 |A2 A3 A4 A5 A6 A7 A8 |A9 A10 A11 | 01/02/04 |02/02/04 StaffName |Work Hr OT Hr Slot1...
4
11695
by: Ajay | last post by:
Hello all, I used to display reports in Excel earlier on my website. Now the client has requested that he would like see reports in Pivot table on the web . The backend is Sql2000. Can you please help in determining hoe we can create a pivot table and display records in it using C#? Thanks Ajay
3
3482
by: Jul | last post by:
Hi, I need to create copy (clone) the OracleConnection object. The OracleConnection class does not contain "Clone" method for creating copy. It contains Protected MemberwiseClone but if use this method: conDB = CType(conValue.MemberwiseClone(), OracleConnection)
0
1080
by: Meelis Lilbok | last post by:
Hi Ho to create 1:1 copy of DatRow inside DataSet? Is there any Copy method or must create new DataRow and then loop trough items and create copy of fields, because i cant copy 1:1 identity fields? Meelis
1
8282
by: prabhun2004 | last post by:
hi all i use postgresql database. There are two databases in that namely 'db1','db2'. In 'db1', thers is a table named as 'table_common'. In 'db2', there is a table named as 'table_common'.
1
2767
by: Tomek | last post by:
Hi, I'm new in C# programming. I received an order to create application with ODBC technology. Application seems to be simple, It should copy table from database, for example SQL server, to another database, for example MySQL. I found solution with SqlBulkCopy, but I stuck with ODBC. Do you have any idea how to do that? Thank you in advance. Tomasz
2
3318
by: Neeraj | last post by:
hi I want to create a table in a database with same schema and data of other database. what i am doing is i make a connection to second database make a select statement "SELECT * FROM modul" DataTable dt = ds.Tables.Copy(); now i get DataTable then how can i save it to another database with same table Name. thanks Neeraj Kumar
1
1627
by: noorulahilah | last post by:
How can i create the table through coding in access? And how can i connect with vb. Suppose "db" is database variable. "stu1" is already existing table name. Now i want to create table "stu2" that copy the structure and data of "stu1" s1="create table stu2 as select * from stu1" db.execute(s1) is it possible?. If not send correct coding
2
1948
by: amit tank | last post by:
Hi All, I Want To Copy Table Data From One Table To Another Both Table Name Are Same But in Other Database I Tried This SELECT * INTO DIMS1.dbo.MstCmp FROM DIMS.dbo.MstCmp where 1>2 But This Doesn't Work When Both Tables Are Same
0
9643
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10147
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10087
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8971
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6737
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5380
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2877
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.