Solved

copy a table with data to another db

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

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…
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…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

757 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

19 Experts available now in Live!

Get 1:1 Help Now