Solved

Copying tables between databases.

Posted on 1998-12-14
4
187 Views
Last Modified: 2010-03-19
Using Transact-SQL.
I've two databases with some identical tables. I want to copy a table from one DB to another as follows.
INSERT Database2.tableX SELECT * from Database1.tableY
Can someone give me the correct syntax of the above ?
0
Comment
Question by:eryan
  • 2
  • 2
4 Comments
 
LVL 3

Accepted Solution

by:
cognition earned 40 total points
ID: 1092265
SELECT *
INTO DB2.dbo.ATable
FROM DB1.dbo.ATable

or

SELECT *
INTO DB2.dbo.ATable
FROM ATable


0
 

Author Comment

by:eryan
ID: 1092266
Thanks
0
 
LVL 3

Expert Comment

by:cognition
ID: 1092267
You may even be able to use
DB1..Table, rather than DB1.dbo.Table
0
 

Author Comment

by:eryan
ID: 1092268
Cheers, That works as well.
Ed.
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
convert in derived column 7 27
SQL Help 27 40
string fuctions 4 25
SQL Server - Set Value of Multiple Fields in One Query 10 22
Nowadays, some of developer are too much worried about data. Who is using data, who is updating it etc. etc. Because, data is more costlier in term of money and information. So security of data is focusing concern in days. Lets' understand the Au…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Via a live example, show how to shrink a transaction log file down to a reasonable size.

813 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

11 Experts available now in Live!

Get 1:1 Help Now