copy data between sql servers using ADO VB visual basic 
Author Message
 copy data between sql servers using ADO VB visual basic

Using VB6, ADO how would I copy data between two sql servers?

I have two connection objects, cn1 and cn2 pointing to two distinct
sql servers.

Let's say T1 is the table on sql server S1 and T2 is the table on sql
server S2.

T1 and T2 have similar table structures. If I want to copy data from
T2 into T1, then within VB6, using ADO, how would I copy the data.

sql1="insert into T1........"

Help appreciated.

Thanks



Mon, 12 Sep 2005 06:35:30 GMT  
 copy data between sql servers using ADO VB visual basic
I believe (but could be wrong) that the only way to use ADO is to bring the
data down to a recordset, clone the record set, then save to server2.  You
might look into using SQLDMO to hook into the DTS methods for copying data.
In fact, an easy way is to create a DTS package to do what you want, save as
a .vbs file, and add it to a VB project.


Quote:
> Using VB6, ADO how would I copy data between two sql servers?

> I have two connection objects, cn1 and cn2 pointing to two distinct
> sql servers.

> Let's say T1 is the table on sql server S1 and T2 is the table on sql
> server S2.

> T1 and T2 have similar table structures. If I want to copy data from
> T2 into T1, then within VB6, using ADO, how would I copy the data.

> sql1="insert into T1........"

> Help appreciated.

> Thanks



Mon, 12 Sep 2005 06:56:44 GMT  
 copy data between sql servers using ADO VB visual basic

Quote:

> Using VB6, ADO how would I copy data between two sql servers?

> I have two connection objects, cn1 and cn2 pointing to two distinct
> sql servers.

You may be able to do this purely with SQL. By fully aliasing the
table names to include the server, you can just fire one SQL command
to do it:

Select * into serv2.s2db.dbo.s2table from serv1.s1db.dbo.s1table

Then let sql do it all!

bcf

P.S. <ServerName>.<DatabaseName>.dbo.<TableName>



Mon, 26 Sep 2005 08:31:56 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. copy data between sql servers using ADO VB visual basic

2. create a copy of sql database structures using ADO in visual basic

3. ADO, SQL Server, VB problem posted to the microsoft.public.data.ado group as well

4. Visual Basic 6 and SQL Server Connections(ADO)

5. Visual Basic + SQL Server/MSDE + ADO timeout problem

6. Visual Basic App using Foxpro DB vs Access DB vs SQL Server DB

7. Visual Basic App using Foxpro DB vs Access DB vs SQL Server DB

8. What is the best way of putting data into two servers(SQL Server and exchange server) from visual basic( ADO) to maintain integrity of data

9. Excel VBA using ADO to extract data from SQL Server

10. Bug using ADO and data combo against SQL Server

11. VB Sql Server Via ADO Problem: [Microsoft][ODBC Sql Server Driver]

12. Quickest way to code Copying/Moving a record key with VB/SQL using ADO

 

 
Powered by phpBB® Forum Software