Solved

Copying tables between databases.

Posted on 1998-12-14
4
198 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

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.
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…
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

635 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