Solved

Copying tables between databases.

Posted on 1998-12-14
4
177 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
Comment Utility
SELECT *
INTO DB2.dbo.ATable
FROM DB1.dbo.ATable

or

SELECT *
INTO DB2.dbo.ATable
FROM ATable


0
 

Author Comment

by:eryan
Comment Utility
Thanks
0
 
LVL 3

Expert Comment

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

Author Comment

by:eryan
Comment Utility
Cheers, That works as well.
Ed.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
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 shrink a transaction log file down to a reasonable size.

728 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

9 Experts available now in Live!

Get 1:1 Help Now