Copy row from one database to another....

lidds

Well-known member
Joined
Oct 19, 2004
Messages
122
Programming Experience
Beginner
I have a MS SQL 2005 database on one server and then a copy of that database structure on a azure server. I want to copy a specific row of data from a table from server 1 to the same table on the azure server.

The problem I have is that I do not know where to start, I am able to connect to both databases from my application. I would really like some advise on the best way to do this?

Thanks

Simon
 
So let's assume you know how to insert a record into your table, and let's also assume you know how to select fields from your table (if you don't, time to hit Google!!)

If you know both of those methods, you know how to copy information from one table to another.

Rather than use your application to do the copy though (which would require a call to your source db and one to your destination) it would make more sense to link the db's - granted there are situations where that's not possible. With a link setup, you can create a stored procedure on your source db that'll do the copy for you - only one call from your app needed.
 
True, Menthos is essentially advocating that you tell one DB to push the data directly into the other, or the other db to pull the data from the first. This is the most efficient way. If you have to see the row, then simply download the row from the source db, copy the data into a datatable associated with the remote db, and execute an update..

Show us your row-loading and saving code so we can get a better idea of how you did it
 
Back
Top