General
Apex SQL Audit
Apex SQL Clean
Apex SQL Code
Apex SQL Data Diff
Apex SQL Debug
Apex SQL Diff
Apex SQL Diff API
Apex SQL Doc
Apex SQL Edit
Apex SQL Enforce
Apex SQL Log
Apex SQL Log API
Apex SQL Recover
Apex SQL Refactor
Apex SQL Report
Apex SQL Script
Apex SQL Source Ctl
Apex SQL SSIS Compare
Knowledgebase Home
Apex SQL Audit
Apex SQL Clean
Apex SQL Code
Apex SQL Data Diff
Apex SQL Debug
Apex SQL Diff
Apex SQL Diff API
Apex SQL Doc
Apex SQL Edit
Apex SQL Enforce
Apex SQL Log
Apex SQL Log API
Apex SQL Recover
Apex SQL Refactor
Apex SQL Report
Apex SQL Script
Apex SQL Source Ctl
Apex SQL SSIS Compare
Knowledgebase Home
|
ApexSQL Knowledgebase Tips and How-to Articles for Apex SQL Tools How to synchronize data from various off-line sources into a central data repository? DESCRIPTION This article describes a typical data merging scenario, between the 2 data tables, and explains how to customize that scenario. SOLUTION A common problem that can be solved using ApexSQL Data Diff data synchronization tool is synchronizing data from various off-line sources into a central data repository. This is a case when mobile devices (laptops) are used to capture data, and later the data is merged to the central data repository. Here are defined Central and Mobile databases with the Person table. -- Create script for the Central database Now, try to merge Mobile persons to a Central in the following steps: Step 1. Select data sources Set the Mobile database as a source data source and the Central database as a destination data source in ApexSQL Data Diff. ![]() After pressing the Compare button, we will get 3 different rows and a single additional row. ![]() Notice a key sign near the ID field. It means Comparison Key is set to the ID field. However, this showcase needs to differentiate persons based on personID field, not on ID. The next step will describe how to do that. Step 2. Set a Comparison Key From Project Settings Object Filter tab find a Person table, and from the Comparison Key column choose to Edit Custom Comparison Key as in the image (set a personID field as a comparison key and click OK). ![]() Missing persons by personID will be automatically selected for synchronization. ![]() The problem is the additional rows. If you left them selected they will be deleted from the Central database. You should unselect them as in the image. ![]() Step 3. Press the Synchronize button to open the Synchronization Wizard ![]() Make sure that the destination is the Central database. ![]() Make sure Missing Records are selected in the Record Filter step. After you press Synchronize button you will get the following script: USE [Central]Problem with this script is that the primary key ID for the Person table is scripted also causing the error: Violation of PRIMARY KEY constraint 'PK__Person__3214EC277F60ED59'.Solution to that problem is not to use the ID field when synchronizing—use the Columns column (Project Settings Object Filter tab), and unselect the ID field as in the image. ![]() Now after we repeat the step 3 the synchronization will went fine. Summary ApexSQL Data Diff enables you to: * Select a Comparison Key (what column or columns ApexSQL Data Diff will track for missing/different/additional records) * Select Columns you want to synchronize. * Select row types to synchronize (Different, Missing, Additional) * Select individual rows to synchronize (using the checkboxes) ![]() Also the other options in ApexSQL Data Diff we haven’t explained here are : * Disable Foreign Keys and Triggers * Drop not Unique Indexes * Disable Check Constraints * Apply Data Format * Filtering Rows for Comparison LAST REVIEW DATE Nov 09 2009 Labels: Apex SQL Data Diff |
© 2010 Apex SQL Tools All Rights Reserved | 1.919.968.8444 | Contact Us | Terms of Use | Privacy Policy









