Solved

Copy a table from one database to another

Posted on 2006-06-22
3
171 Views
Last Modified: 2012-08-14
Evening experts.

All I need to do is copy 1 remote table from a backup database, to another database on the same sql server.  Table has to include the data from the backup.

Everything I have tried keeps trying to copy every table, with all data.  Simply just need a copy and paste like situation. There are no triggers, indexs etc, just the table structure, the keys, and data.

Thanks.
0
Comment
Question by:moonrisesystems
3 Comments
 
LVL 21

Accepted Solution

by:
Yurich earned 125 total points
Comment Utility
standard backup/restore routine will try to do it as a whole database. what you can try to do is:

1. export your table using DTS from your database and then import it where you need to get new data.

2. restore database under a different name and then run a query to insert everything from that table and that database into your current table, of the current database.

i'm not sure which one would be easier for you, but they're both not bad ;)

good luck,
yurich
0
 
LVL 75

Expert Comment

by:Anthony Perkins
Comment Utility
Another approach:

Use DestinationDatabase

Select *
Into DestinationTable
From SourceDatabase.dbo.SourceTable

You will have to add the indexes/constraints after that is complete.
0
 
LVL 13

Expert Comment

by:Atlanta_Mike
Comment Utility


If this table is the same table from an "older" backup copy are you worried about duplicates, are you trying to replace data?

If not, AC's solution is the easiest since its on the same server.

0

Featured Post

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Join & Write a Comment

Performance is the key factor for any successful data integration project, knowing the type of transformation that you’re using is the first step on optimizing the SSIS flow performance, by utilizing the correct transformation or the design alternat…
Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

772 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now