How to synchronize from SQL Express 2008 to SQL Server 2008? - c#-3.0

I have an app the runs at the store level extracting data out of a POS system. This app asks the POS system for data which in return produces some .DBF files. The app loads the DBFs in memory and saves it to SQL Server 2008 Express at the store level. This happens at 3 different stores.
I have been looking into the Microsoft Sync Framework, but have not come across any good examples of how to sync tables in one direction only, from each of the stores into a single database at the corporate level.
The data at each one of the stores is being managed by the app(delete, update, insert).
Does anyone know a good article, that I could read about synchronizing SQL data?
Thank you.

Try the following link
http://www.codeproject.com/KB/database/DTS_SQLExpress.aspx

Related

Merging two database into single database

I have deployed same application in two different computers. Now i need to merge both data from two different database into single database.
The application is developed using c# .net and uses sql express 2008.
The problem arised because i could not use the application over LAN.
So i need to merge the two database into one.
So please help me to solve the problem to merge it.
I also need to run the application over LAN but the sqlbrowser doesnot start and i have searched the internet for the answer but i haven't been lucky.
thank you, waiting for response.
The approach you want to take will depend largely on your schema, but Microsoft Sync Framework should likely be useful. It would let you define rules for resolving conflicts and merging your data.
As for accessing your data over the LAN, this post has a good overview of what it takes to enable remote access to your SQL Server Express.

SQL Azure data synchronisation and maintaining the history of the database

I have an on-premise database. At the same time I have the database on cloud. When the on-premise database gets updated the SQL Azure database should also get updated. Only the changed fields should be updated. The rest should remain the same. How can this be achieved in minimal time?
There is a No code solution called Data SYNC CTP2 but you need to request access which unfortunately stopped for now. (http://connect.microsoft.com/sqlazurectps)
You could try using SYNC framework. Have a look at this article: http://blogs.msdn.com/b/sync/archive/2010/08/31/sql-server-to-sql-azure-synchronization-using-sync-framework-2-1.aspx
just a note. Neither Sync Framework or Sql Azure Data Sync does column level change tracking or synchronization. When a column in a row is changed, the entire row is sent during synchronization.
As Paras mentioned, Sql Azure Data Sync is in CTP stage (CTP2 now, with CTP3 supposed to come out this summer).
Sync Framework 2.1 however already supports synching with Azure.
check out Synchronizing with SQL Azure using Sync Framework
for links to various walkthroughs/samples

Migrate and synchronize local SQL data to SQL Azure?

Is there any way to migrate and synchronize data between an on-premise SQL database and SQL Azure database apart from sync framework?
The sync framework works fine for small databases, but when it comes to large databases its not working. Is there any possible way to migrate and synchronize using change datacapture and SSIS?
you might want to clarify what you mean by "its not working". Are you having issues during the initial sync or incremental sync? what's the sync direction required for your sync? upload/download/bidirectional? do you get an error?
there are many ways to do the migration,
for synchronization, apart from Sync Framework, you may also look at Sql Azure Data Sync (largely based on Sync Framework too).
and yes, you can use Change Data Capture and SSIS if you want but note that Sql Azure doesnt have the same Change Data Capture feature as Sql Server so you'll be fine using CDC and SSIS for on-premise to Sql Azure sync only. You have to figure out another way to do change tracking on the Sql Azure side.

How do I import data from Microsoft Access / SQL Server 2005 into Core Data?

I am sitting on a ton of data in a SQL Server 2005 database, from which we dump Access databases as a cache.
I want to create an iPhone app based on Core Data that can use this data from my SQL Server 2005 database, or the Access dump.
Based on all of the Core Data tutorials and documentation it appears that I have to use Xcode to create a Core Data schema and populate that schema using Xcode.
SQLite seems like the right thing to act as a dump point, then use SQLite APIs. But this doesn't bridge nicely to Core Data in my mass data scenario.
Apple has obsoleted the SQLite Books Example seemingly with the sole intent of making sure that you use Core Data and not SQLite.
Has anyone come up with a dump scheme for data locked in an Access or SQL Server 2005 DB into an iPhone friendly format? I don't care if it is Mac OS X code, iPhone code, or .NET code... Anything?
In my case I am talking about 26MB of data that I would like to have an offline cache to for my application.
26MB of XML seems like a bad idea. 26MB of SQLite seems like a great idea. 26MB of Core Data seems like an even better idea.
Thanks in advance,
--Batgar
You could create an Objective-C app in XCode using the FreeTDS library to pull data down from your MSSQL database and populate your CoreData store.
http://sourceforge.net/projects/freetds/
There's also a commercial product that provides an MSSQL ODBC driver for Macs, which you could then call from your data migration code:
http://www.actualtechnologies.com/product_sqlserver.php
If that doesn't work, you can set up the MSSQL database with an IIS front-end and retrieve the data using XML queries. Starting with MSSQL 2000, there's a way to query the server directly via HTTP and get back results in XML without having to write any ASP/ASP.NET code.

Synchronisation between SQL Server 2008 Express and VFP tables

I'm looking for advices and suggestions on how to synchronise data between two databases.
The first database is a SQL Server 2008 Express that run on disconnected laptops (no network or internet access). The second database (main) is a VFP 9.0 that run on a server.
When the user connect their laptop on the network, I want the synchronisation process to go through.
Other than the different database engines, I have the following items to take into account:
The tables don't necessary have the same structure
The primary keys are not the same (GUID in the SQL Server and often a combination of character fields in VFP)
Synchronisation of the tables must be done in a certain order to respect the parent-child relationships
On some insert on the SQL Server side, a new primary key must be generated and synchronised in the VFP table
A bunch of validations must be made and some feedback from the user are sometimes needed
Not all records need to be synchronised
Some records on the SQL Server need to be deleted after the syncronisation
Need to take into account deleted records from both side
Minimal modifications need to be done on the VFP database
There are probably other points I'm forgotting now, but I think you get the idea of the challenge I face. My guess right now are that I will need to build a custom synchronisation module, but I want your input before I go on in case I overlooked some options and to get some tips on how to approach this.
I looked rapidly at Microsoft Sync Framework, but with all the restrictions I have and the fact that there is no VFP client already built (AFAIK), I don't think it will be of great help.
Thanks in advance for your feedback.
Update: The laptop application is a C# WinForm application and is using SQL Server 2008 Express.
The complexity of the situation and requirements leads me to believe you need to write a Visual FoxPro application. Visual FoxPro connects to SQL Server 2008 data easily. The complexity of the code is matching the requirements and identifying the data that needs to be synched, not the syntax. Visual FoxPro strength is in the data manipulation language and the ability to connect to almost any data source (native DBFs, ODBC, ADO, and XML).
SQL Server can read VFP 9 data via the VFP 9 OLE DB driver. You could write T-SQL stored procedures to get to the VFP data. Not sure how it would recognize the laptop being connected to the network though.
Another approach is to use SQL Server XML Diffgrams. I am not an expert by any stretch of the imagination on this approach, but it would be something you can research.
Since my expertise is with Visual FoxPro I would find it way easier to go the other way though, but that is just me. You have to go with the skillset of the resources you have for the project.
VFP reads and writes SQL Server data via a connection (DSN, ConnectionString) and any technique involving SQL Passthrough (SQLConnect(), SQLExec() and SQLDisconnect()), CursorAdapters, Remote Views, or a combination of the three.
A Visual FoxPro program can also recognize Windows Events like connecting to a network. The application could be installed on each laptop and running to recognize the Windows Event. Once the event is raised the application can attempt to connect to the SQL Server database (possible it is connecting to a network without the SQL Server available or a different network).
Once connected it runs the logic to check and synchronize the databases.
Sounds like you don't have a lot of control over the application writing to the VFP 9 data on the laptop. If you do have control over the application writing to the VFP 9 database you might consider changing the app to write to a SQL Server Express instance on the laptop and then you can use SQL Server replication to manage the synchronization. Not a trivial task though and SQL Server replication, while getting better with each release, does cause hair loss in DBAs. Definitely a lot of work going this route.
Rick Schummer
Visual FoxPro MVP
I would encourage you to take another look at MS sync framework. We have a situation where we want to synchronize occasionally connected C# clients apps with our Java/Oracle backend. You can use the sync framework providers for the C# client and implement your own custom subclass of KnowledgeSyncProvider for the backend. This will get you half-way there, and show you a good pattern to apply for the rest.