Solved

copy a table with data to another db

Posted on 2013-06-25
2
219 Views
Last Modified: 2013-06-25
I have a table1 in database1.  I would like to have all the structure and data copied to database2 with the name table1.

How can I do this in SQL 2008
0
Comment
Question by:al4629740
2 Comments
 
LVL 65

Assisted Solution

by:Jim Horn
Jim Horn earned 150 total points
ID: 39276616
SELECT *
INTO TargetDatabase.TargetTable
FROM SourceDatabase..SourceTable

Then I'd check the TargetTable to make sure identities are set, constraints are still there, etc.

If that fails, a better way may be to script out the SourceTable, change the database/table name, then execute it in TargetDatabase.

Create Table
Then...

INSERT INTO TargetDatabase.TargetTable
SELECT * FROM SourceDatabase..SourceTable
0
 
LVL 12

Accepted Solution

by:
duttcom earned 350 total points
ID: 39276627
You can also right-click on your source database and choose Tasks -> Export Data.

The wizard then steps you through the selection of the data source and the destination and copies the table for you.
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Suggested Solutions

If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

860 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