views:

102

answers:

3

I have a copy of client database say 'DBCopy' which already contains modified data. The copy of the client database (DBCopy) is attached to the SQL Server where the Central Database (DBCentral) exists. Then I want to update whatever changes already present in DBCopy to DBCentral. Both DBCopy and DBCentral have same schema. How can i do it programatically using C#.NET maybe with a button click. Can you give me an example code as how to do it?. I am using SQL Server 2005 Standard Edition and VS 2008 SP1.

In the actual scenario there are about 7 client database all with same schema as the central database. I am bringing copy of each client database and attach it to Central Server where the central database resides and try to update changes present in each copy of the client database to central database one by one programatically using C# .NET . The clients and the central server are physically seperate machines present in different places. They are not interconnected.

I need to only update and insert new data. I am not bothered about deletion of data.

Thanks and regards Pavan

A: 

Go check out Sync Framework. Otherwise, go create some SSIS packages and run them.

Jaxidian
Thanks so much for the reply. Also i want to mention that there is about 50 tables and probably same number of views and SPS. So it is a huge data. Which one will be a feasible solution. As i am very new to this can you give me some example code or a few references for using Sync Framework and creating SSIS pacakages?.
Pavan Kumar
A: 

What you are describing sounds an awful lot like Database Mirroring.

Daniel DiPaolo
Thanks shall look on to it also...:)
Pavan Kumar
A: 

If this is a one-time or infrequent sync, then I'd use a third-party tool such as Red-Gate's SQL Data Compare. If this is meant as an ongoing sync, then I'd recommend replication or the Synchronization Framework.

Thomas
Thanks for the reply. Actually i am new to this, I didnt understand what you meant by infrequent sync and ongoing sync, these terms are new to me. The idea is something like this: once i attach the copy of client database and perform updation to central database i will then simply detach or delete the copy. The copy of the client database is brought to server once or twice a month and attached to the server where the central database resides and then perform the updates from copy to central database.
Pavan Kumar
Red-Gate's SQL Data Compare will be expensive solution for me. I am still a student and this is for my academic project.
Pavan Kumar
@Pavan Kumar - By infrequent vs ongoing, I was referring to how often you would have to perform the sync. If its once every couple of months and not on a schedule, then using a tool will be simpler. If it is something that must occur every month, then scripting it would be better. Replication would be the simplest solution as synchronization is what it was designed to do. After that, I'd look at the Sync Framework.
Thomas