Click to See Complete Forum and Search --> : copy contents from databases


sriky
October 14th, 1999, 09:14 AM
I use 'insert into table1 select * from table2' to copy contents from one table to another when they are in the same database.

But how do I do that if the tables are in different databases. I am using ADO's in VB. Do I need to open both the databases and then use the statement?

Thanks

Lothar Haensler
October 14th, 1999, 10:28 AM
it probably depends on your backend.
If your database is SQLServer you do not need to open both databases. Just open the target database and issue a statement like
insert into table1 select * from database.owner.tablename
you can even use the following syntax to insert from another server
insert into table1 exec server.database.owner.spName