Solved

Copy a table from one database to another

Posted on 2006-06-22
3
174 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
ID: 16965699
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
ID: 16965715
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
ID: 16965742


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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
run a stored procedure from vb.net 1 27
Problem with email format from SQL DB 4 34
Nested Case statement 4 36
sql 2016 data tools breakdown.. 1 10
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
I have a large data set and a SSIS package. How can I load this file in multi threading?
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
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

792 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