Dashboard > INTEGRATION GUIDES > Integration Guides > Table Update
  INTEGRATION GUIDES Log In | Sign Up   View a printable version of the current page.  
  Table Update
Added by Alex Khizhnyak, last edited by May on Jun 15, 2008  (view change) show comment
Labels: 
(None)

This guide will help you learn how to update records in a table, e.g. overwrite only the entries that have been changed.

Configuration

To update a table, you need to open the output database connector and switch it to the Update mode during configuring the connector's properties. You can do this when the list of the source data fields is being displayed.

After you switched the table to the Update mode, you also need to choose the primary key by selecting the field(-s). It is the very field which indicates what data is to be updated. If the destination table contains the entries with primary keys equal to the primary keys of the source table, then the input records with such enties will be updated.

For instance, if you have an ID, Name, Email, and Phone, you can set the record to be checked by ID and Name (or just ID) and then, if these are identical, Apatar will only update the Email and Phone.
Please note that you need to transfer the whole record to update the table properly.
There is also another option while configuring the update mode, "Clear the selected table before any data written". If you choose it, then all your old data will be removed.

Example

Let's now explore how data can be transferred using different modes. In the example below, the source table contains recent updates, and the target table is the destination that should represent the final view of the data.

Source table:

No. Company FirstName LastName Email Phone Title
1 ABC John Smith J@abc.com 123 CEO
2 Microsoft Jim Black jim@ms.com   QA Engineer
3 Joomla Phil Collins PC@joo.cn    

Target table:

No. Company FirstName LastName Email Phone Title
1 ABC John Smith J@abc.com 123 123 5766  
2 IBM Kate Adams   235 888 9966  
3 Microsoft Jim Black jim@ms.com   QA Engineer

Transformation in the Insert mode:

No. Company FirstName LastName Email Phone Title
1 ABC John Smith J@abc.com 123 123 5766  
2 IBM Kate Adams   235 888 9966  
3 Microsoft Jim Black jim@ms.com   QA Engineer
4 ABC John Smith J@abc.com 123 CEO
5 Microsoft Jim Black jim@ms.com   QA Engineer
6 Joomla Phil Collins PC@joo.cn    

(The records from the source table were added to the target table regardless of where they existed there before or not.)

Transformation in the Update mode:

No. Company FirstName LastName Email Phone Title
1 ABC John Smith J@abc.com 123 CEO
2 IBM Kate Adams   235 888 9966  
3 Microsoft Jim Black jim@ms.com   QA Engineer
4 Joomla Phil Collins PC@joo.cn    

(The ABC record was updated, as it exists in both the source and target tables. The Joomla record was added, as it hadn't existed in the target table.)

Transformation in the Synchronization mode:

No. Company FirstName LastName Email Phone Title
1 ABC John Smith J@abc.com 123 CEO
2 Microsoft Jim Black jim@ms.com   QA Engineer
3 Joomla Phil Collins PC@joo.cn    

(The first record was updated, the IBM record was deleted, and the Joomla contact was added.)

excuse me

cau u explain again to me

how to update data ??

i have try like you but its fail and make the data empty.

also i want to ask, how to delete data with apatar ?

and apatar use query like this

"select field from table where name like '%a5%'

 thanks,

randy 

Hello, Randy!

For this purpose, you need to use the Synchronization mode.
If any record is deleted in the source table, it will be deleted in the target table.

Or, you can also delete ALL entries, if you choose "Clear the selected table..." in the Update/Insert mode.

Site running on a free Atlassian Confluence Open Source Project License granted to Apatar Data Integration (ETL). Evaluate Confluence today.
Contact Administrators