This command performs the actions on the target table that have been saved in the log table.

Syntax

SYNC target [FROM {LOG | target_clog} [WITH KEY (col1,...)] [USING 'compare_name']]

Arguments

  • target - Target database.

  • LOG - the log table containing actions for the target table.

  • target_clog - The log of an earlier COMPARE command.

  • WITH KEY

    • If the key is not given and the target is a table, the primary key of the target is used.
  • USING ‘compare_name’ - if omitted all records in the log table will be used for the SYNC.

Additional Information

  • target_clog defaults are same as the COMPARE command.

    • Whether the target_clog table is temporary or permanent, the SYNC is constructed from:

        * Delete from target
      
        * Update target
      
        * Insert into target
      
  • The number of affected rows is returned as the updated count.

Examples

Example tables are drawn from the imdb database, for instance:

  • cast_info (id, person_id, movie_id, person_role_id, note, nr_order, role_id)

  • movie_keyword (id, movie_id, keyword_id)

  • company_name(id, name, country_code, imdb_id, name_pcode_nf, name_pcode_sf)

SYNC using results of a previous COMPARE saved in default table

  • Default table: lim.imdb.public.keyword_clog.

  • The key is included because the primary key has not been defined on the target table.

SYNC lim.imdb.public.keyword FROM LOG WITH KEY (id) ;

SYNC using results of a previous COMPARE saved in a named table

  • Named table: lms.cirrodb.dbo.keyword_clog

  • The same primary key defined on the target.

SYNC lim.imdb.public.keyword FROM lms.cirrodb.dbo.keyword_clog ;

SYNC using results of a previous COMPARE that saved in default table

  • Table has specific name
SYNC lim.imdb.public.keyword FROM LOG AS 'Post-run check #1' ;

See Also