Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Can I insert data from one database to another?

Author  Topic 

pir8d
Starting Member

10 Posts

Posted - 2007-05-09 : 19:58:20
Hi, I'm trying to do a data migration and would like to transfer data from one database to another.

For example:

INSERT INTO database1.table1
(field1, field2, field3)
SELECT field1, field2, field3
FROM database2.table1
Is this possible?

dinakar
Master Smack Fu Yak Hacker

2507 Posts

Posted - 2007-05-09 : 20:11:01
yes if they are "linked" => if you can access the souce data from the target server (or vice verca).

INSERT INTO database1.dbo.table1 (field1, field2, field3)
SELECT field1, field2, field3
FROM database2.dbo.table1



Dinakar Nethi
SQL Server MVP
************************
Life is short. Enjoy it.
************************
http://weblogs.sqlteam.com/dinakar/
Go to Top of Page
   

- Advertisement -