Solved

Copy a table from one database to another

Posted on 2006-06-22
3
176 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I have a large data set and a SSIS package. How can I load this file in multi threading?
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
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

738 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