468,310 Members | 1,428 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,310 developers. It's quick & easy.

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 295020
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Ajay | last post: by
3 posts views Thread by Jul | last post: by
reply views Thread by Meelis Lilbok | last post: by
1 post views Thread by Tomek | last post: by
2 posts views Thread by Neeraj | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.