mustang61
asked on
Insert Into SQL Server from another SQL Server using VB 2008
Is it possible to use Visual Basic to copy data from a sql server to a remote sql server?
If so what is the easiest way to do it?
If so what is the easiest way to do it?
This one for manually copying
http://www.sqlteam.com/article/use-sqlbulkcopy-to-quickly-load-data-from-your-client-to-sql-server
http://www.sqlteam.com/article/use-sqlbulkcopy-to-quickly-load-data-from-your-client-to-sql-server
ASKER
I created the 2 connections - i am a vb beginner - is the code easy to write to insert the table from one to another on different servers?
Code is easy but its just the performance side which you need to consider.
Open connection to server1
open connection to server2
use a command and datareader to read server 1
While DataReader.Read
command2.commandtext = "Insert into ..."
command2.executenonquery
End While
Open connection to server1
open connection to server2
use a command and datareader to read server 1
While DataReader.Read
command2.commandtext = "Insert into ..."
command2.executenonquery
End While
ASKER
these tables are not large and once the initial copy is done it will be only addons based upon on yes/no checlbox
Then the manual row by row copy should be fine
ASKER
the example is written in 'C' - not good at converting
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Worked to perfection - THANKS!
Glad to help :-)
1. Establish two connection strings and connect to both servers
2. Fetch records from one Server
2a. If records are huge, dump records into a flat file and then insert from that temp file to another server.
3. Insert into another server.