Sql script that compares two db,s and updates db and insert date of update
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: Sql script that compares two db,s and updates db and insert date of update

  1. #1
    Join Date
    May 2013
    Posts
    2

    Sql script that compares two db,s and updates db and insert date of update

    Hi i need some help creating an sql script that can update info from one table in dbase1 to another table in dbase2 that has the same columns and if posible insert date and time in one column when the syncronized is done? Can anyone help mee whit this?

  2. #2
    Join Date
    Jul 2002
    Location
    Lake Worth, FL
    Posts
    1,476

    Cool

    Quote Originally Posted by miguel_q View Post
    Hi i need some help creating an sql script that can update info from one table in dbase1 to another table in dbase2 that has the same columns and if posible insert date and time in one column when the syncronized is done? Can anyone help mee whit this?
    1) Create database link.
    2) Use MERGE statement.
    "The person who says it cannot be done should not interrupt the person doing it." --Chinese Proverb

  3. #3
    Join Date
    May 2013
    Posts
    2

    help with creating the procedure

    how can i create this query on a procedure:

    Insert into COMPUSOFT.PESAJE@DB_2
    (PSJ_GESTION, PSJ_COD, PSJ_PLACA, PSJ_PESO, PSJ_FECHA,
    PSJ_ESTADO, BLZ_COD, MNF_COD, DMN_COD,
    USR_COD, PSJ_OPERACION, TIC_COD, PSJ_TARA, PSJ_NETO)
    select /*+ FULL(Tbl1) */
    PSJ_GESTION, PSJ_COD, PSJ_PLACA, PSJ_PESO, PSJ_FECHA
    , PSJ_ESTADO, BLZ_COD, MNF_COD, DMN_COD, USR_COD
    , PSJ_OPERACION, TIC_COD, PSJ_TARA, PSJ_NETO
    from COMPUSOFT.PESAJE Tbl1
    where PSJ_OPERACION='IMP'

    minus
    select /*+ FULL(Tbl2) */
    PSJ_GESTION, PSJ_COD, PSJ_PLACA, PSJ_PESO, PSJ_FECHA
    , PSJ_ESTADO, BLZ_COD, MNF_COD, DMN_COD, USR_COD
    , PSJ_OPERACION, TIC_COD, PSJ_TARA, PSJ_NETO
    from COMPUSOFT.PESAJE@"DB_2" Tbl2
    where PSJ_OPERACION='IMP';

    plus i would like to insert also that when it runs the query also change a value in table pesaje column dmn_cod to "yes" default "no" in db_2

    any help please???

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width