?
Solved

Copy a table from one database to another

Posted on 2006-06-22
3
Medium Priority
?
178 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 375 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
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
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Suggested Courses

752 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