473,241 Members | 1,664 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,241 software developers and data experts.

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 295525
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.google.c om...
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.google.c om...
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.google.c om...
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_spam." 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_spam.peasland.com> wrote in message
news:3F1E8D4A.D0B2AB56@remove_spam.peasland.com...
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.google.c om...
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_spam." 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
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...
1
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,...
4
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...
3
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...
0
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...
1
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...
1
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...
2
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"...
1
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"...
2
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...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

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.