Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > .NET Web Services
.NET Web Services Discussions about .NET XML Web Service technologies including ASMX files, WSDL and SOAP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Web Services section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old November 18th, 2004, 04:41 AM
Friend of Wrox
Join Date: Sep 2003
Posts: 101
Thanks: 0
Thanked 0 Times in 0 Posts
Default copying tables from one database to otherdatabase


I working on ASP.NET
I have 2 databases called databaseA,databaseB.
databaseA reside on ServerA and databaseB reside on ServerB i want to copy the some table from databaseA to databaseB how to do

can it done by select statement or SP?

Old November 22nd, 2004, 10:40 AM
planoie's Avatar
Friend of Wrox
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts

Normally you can do this directly thru a SQL call. You'd need to write an application that pulls the data from one datasource, and pushes it to another. However, you can link MS SQL Server instances and can then select across server boundaries thru SQL. Post this question in a SQL forum for some help with it. I've never worked with linked servers, I just know that it is possible.
Old December 25th, 2004, 12:50 AM
SQLScott's Avatar
Wrox Author
Join Date: Dec 2004
Posts: 338
Thanks: 0
Thanked 2 Times in 2 Posts

Does the table already exist in both databases (meaning, are you just trying to copy the data) or are you trying to copy both the data AND table schema?

If the table exists in both database and you are just trying to copy the data, you can accomplish this easily by creating one connection to databaseA, and a second connection to DatabaseB. Then create a dataset to each table and use the Merge method of the dataset object to "copy" the data. It works quite well.

Now, if you need to copy the table schema AND data, this gets a little tricky. Ket me know if this is what you are attempting and I will find something to do this (I remember seeing something like this somewhere...just need to find it again).


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copying Tables From SQL Server 2005 to 2000 MissHenesy SQL Server 2005 0 April 15th, 2008 12:18 PM
how to get all the tables from a database rakeshgv SQL Server 2000 4 December 1st, 2006 08:33 AM
Copying Table From one Database To Anoter Database jayanth_nadig VB Databases Basics 1 June 19th, 2006 02:39 PM
load tables into database kobystud C# 4 July 20th, 2004 12:31 PM
Copying a database Droobles SQL Server 2000 2 February 19th, 2004 09:13 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.