Occasionally connected application (SQL Server data synchronization) - sql-server

There is a central server that is running SQL Server 2008 R2 and WinForms clients, which use SQL Server CE to cache data. Data can be changed on both the server and client side. Each user can only edit his own data and view some of the data of other users. For example, a user can create a "Contract" and upload it to the server via synchronization, other users need to see this "Contract", except for customer's contact information, etc.
What a way to synchronize data is most suitable for this task?
Thanks in advance.

you can use Sync Framework to synchronize the local cache to a central server. You can either use the Local Database Cache Wizard in Visual Studio or code the sync yourself.
see Synchronizing SQL Server and SQL Server Compact
or Programming Common Client and Server Synchronization Tasks

Related

What are my options for accessing an SQL Server database through MS Access front-end while offline

I'm currently working on a project proposal which would require moving multiple Access databases into a new MS SQL Server database. The idea is to keep the front end program as MS Access so that the users are familiar with the process of inputting data and creating reports.
However, things get complicated in that the internet in the areas where the survey will be collected has poor connectivity and will be out from time to time. I had thought of a few ways of solving this issue but all of them are cumbersome:
1) Having a PC with a router that stores the SQL Server database in offline mode and the data entry PCs connect to the PC with the offline database through the router. The PC with the SQL Server database can then backup the db on the server when it has an internet connection.
2) Adding the data to MS Access databases that can then be merged with the SQL Server at specified increments (this would probably cause some issues).
We've done option 1 before for similar projects but never for connecting to an SQL Server database in offline mode. However, it seems feasible.
My question is: Does anyone know of a way of using Access as a front end application for SQL Server and being able to update data during times without internet connectivity? The SQL Server database would automatically assign primary keys, so, duplicate unique values shouldn't be an issue while syncing the data.
Thanks for your help. I've been having a hard time finding an answer on Google and syncing to databases is complicated at the best of times. I'm really just looking for a starting point to see if there are easier ways of accomplishing this.
I would run a the free editon of SQL express on all laptops. So the Access database would be the front end to the local edition of SQL express. SQL express can be a subscriber to the "main" sql database. You thus use SQL replication to sync those local editions of SQL server to the master server. Of course the main SQL server can't be the free edition of SQL server. So to publish the database for replication, you can't use the free edition, but those free editions can certainly be used as subscribers.
This approach would eliminate the need to build or write special software for the Access application. You thus do a traditional migration of the access back end (data tables) to sql server, and then simply run the Access application local with sql express installed on each laptop. You then fire off a sync to the main edition of sql server when such laptops are back at the office.
The other possible would be to adopt and use the net sync framework. This would also allow sync, and would eliminate the need to run sql expess on each machine. I think the least amount of effort is to sync the local editions of sql express with the main editon of SQL server running at the office (but that office edition of SQL server can't be a free edition).

Sync two or more SQL Server 2012 databases

I am working on SQL Server 2012 and my requirement is to synchronize two or more databases that exist on different servers or locations.
I have tried this with 2008 by using synchronized option appear when we right click on database name.
But did not get any solution for SQL Server 2012.
I have done this successfully using Service Broker on a database that needed to sync only specific data (ie. sync clients and orders between a web and a local database).
It is a bit painful to set up, but works brilliantly once in place.
That said, I wouldn't do it if you need to replicate the entire database.

Free FoxPro DB to SQL Server DB sync tool

Which software can you recommend to sync data from a FoxPro source to a SQL Server destination?
Here are a couple links with information that might be of help:
Migrating From Visual FoxPro
VFP conversion to support SQL server Backend
At my company we have data being written to foxpro tables daily, and are synced to SQL Server nightly using SSIS, so for the actual conversion I recommend that.
Getting the foxpro data to your central location could be accomplished by transferring the foxpro files via FTP (we've done this for years), or you could set up some sort of Web Service.
I don't think you'll find a tool to do this automatically and on a scheduled basis especially if they are geographically remote and the sync has to happen over the public internet. I'd be looking at writing a web service of some sort, which will sit on a server on the VFP side with methods to expose the VFP data, and another service on the SQL Server side to access that web service periodically and perform CRUD operations.

Sync Framework: Can I synchronise Stored Procedure

Does the sync framework allow me to synchronise (download only) the Store Procedures on a sql server 2008 server with the Stored procedures on the SQL Server 2008 client?
i.e. overwrite the SP on the client when the server SP's have been modified or new ones created?
No you cant do that, The Sync Framework is designed to sync data from server to a users pc and back again. While it can synchronize between servers, you are better off using SQL2008 replication engine, or a 3rd party API, such as Redgates SQLcompare, which you can operate programatically.
Microsoft Sync Framework is used to synchronize data not the database schema or the periphery. Generally speaking, this is an application update issue.

Exporting SQL Server Databases for offline use

I have a desktop application (C# .NET 3.5) that uses a SQL server for it's database. I have had a request from the client, however, to make it possible to export the database as it stands, and be able to use it on a laptop without connectivity. They understand that updates to the parent server will not be reflected in these offline clients.
Is there a way I can just save the DataSet's to a binary form and write them to a disk and send those files to the offline clients.
There is an entire line of tools and technologies covering this case, namely the Synch Framework. See Synchronizing Databases. See Getting Started: Client and Server Synchronization for a starting example involving a SQL Server Compact Edition file on the client (.SDF file) that is synchronized with a SQL Server central database. Note that the client won't install anything else other than you application, the SQL Server CE is just a few in-process DLLs that you distribute with your app, nothing nearly as complex as a SQL Express edition on the client.
The good news is that Synch Framework no only allows the client to get their own on-the-go snapshot of the database, it actually allows for changes applied while disconnected to be merged back into the central site.
You could either use Compact Edition (aka. SDF files), or you can save the datasets as XML using the built-in method.
Can't you just take a SQL Server level backup and have them install e.g. SQL Server Express on their laptops and restore the database there?
That way you wouldn't have to do anything special in your app at all - just change the connection string to point to the local SQL Server Express instance, and off you go! No mucking around with serialized data sets and stuff......

Resources