Solved

copy a table with data to another db

Posted on 2013-06-25
2
217 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

There have been several questions about Large Transaction Log Files in SQL Server 2008, and how to get rid of them when disk space has become critical. This article will explain how to disable full recovery and implement simple recovery that carries…
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

863 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

20 Experts available now in Live!

Get 1:1 Help Now