Jader Dias
Jader Dias

Reputation: 90465

How to transfer tables/databases between two remote T-SQL Servers programatically in .NET?

I think the question explains itself

Upvotes: 0

Views: 1189

Answers (4)

Donald Byrd
Donald Byrd

Reputation: 7778

I assume you cannot link the servers directly or indirectly and use DTS to do this?

There is a Microsoft.SqlServer namespace that you can use to interact with SQL Server with (see simple example, I once used this to do a complicated business rules data sync operation between remote and local databases. But that was all code, not a point & click utility.

EDIT: You can create and schedule DTS packages (think scripts) to execute multi step data transfer & transformation processes. Here is a link that talks about interacting with DTS in c#

Upvotes: 1

VladV
VladV

Reputation: 10349

Add the first server as a linked server to the second one. Create the necessary tables and use plain INSERT...SELECT to copy the data. You could also use OPENDATASOURCE function instead of creating a linked server.

If you cannot configure the servers to access each other, you could just read the data to your app - using a DataTable or DataSet, - and then use SqlBulkCopy to write it to another server.

Upvotes: 0

msvcyc
msvcyc

Reputation: 2593

How about doing a database backup and restore programatically?

Upvotes: 1

David
David

Reputation: 73554

Does this help? SqlBulkCopy Class

Upvotes: 2

Related Questions