I want to make an exact copy of a table in SQL Server 2000.
If I right click on the table I can select copy, but paste does not show up?Hi
You're probably better off right clicking the database itself (in Enterprise Manager), and selecting All Tasks | Import Data. Even though the data source and destination are the same, you can make it copy to a table with a new name. When you get to the list of available tables, check the one you want then alter the destination to a new name - click on transform to get an idea of what's going on.
I find that I need to setup my identities and keys again, but otherwise works well.
An alternative would be to copy the table as you've done, then use the above to pull data into it (or an insert statement).|||How about just "select * into new_table from old_table"?|||rd is exactly right that syntax would do... 'Select * INTO'|||I was able to do it that way. I was wondering if there is an easy way to just copy and paste - similar to how you would do it in access.
I guess I don't understand why you can copy a table but not paste it.|||When you right-click copy a table name in Enterprise Manager, you are only copying the table design. If you go to your Query Analyzer window and paste, you will see the create table statement for that table. This is functionally equivalent to right-clicking on the table in the Query Analyzer object browser and choosing "Script object to Clipboard As >> Create."|||Be aware that "select * into new_table from old_table" does not make an exact copy of the TABLE. It makes an exact copy of the DATA. Any indexes, foreign keys, or triggers associate with the table will not be created.|||i think the effective question is the one we always end up asking
What do you want to copy a table for ?
or
what are you trying to do and maybe we can help you find an easier way to do it.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment