Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copy data from one table to another at different database

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
0
0
I have two identical tables with the same attributes but in different tables.
I want to copy the data of one of the tables to another. How to do it?
 
right click on the source data base, select all tasks|export data...
use the wizard. After you select the destination database you can use a query to transfer data. I think you can just use the Query Analyzer too.
USE <source database>
INSERT <fully qualified table name in target database>
SELECT * FROM <table in source database>

I started out with nothing, and I still have most of it.
 
Thanks for you suggestion.
But would you give me an example?
For example, the source database is named as 'dog' and the table is 'ans1' while the targest database is named as 'cat' and the table is 'ans2'

Note that 'ans1' and 'ans2' are actually the tables with the same attributes... Thanks a lot
 
if you are in the 'dog' database..

insert into cat..ans2
select * from ans1

or from the 'cat' database..

insert into ans2
select * from dog..ans1

Tables would need to be identical in order for this to work.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top