Compare 2 identical tables script

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kanaka
    New Member
    • Sep 2010
    • 4

    Compare 2 identical tables script

    Hello all,

    I have below SQLs to compare data between 2 identical tables.in my database.

    Can any body help me to convert this into a script

    db2 "select *from TAB1 where PK IN (select PK from TAB2) order by BEDG_NR".
    Note:
    These SQL should run for any given 2 tables as input TAB1 ,TAB2 and same primary key (PK).
    This is db2 database
  • Aniket sonmale
    New Member
    • Jan 2011
    • 7

    #2
    Try this if you are using linux

    db2 "select *from TAB1 where PK IN (select PK from TAB2) order by BEDG_NR">tab1.t xt

    db2 "select *from TAB1 where PK IN (select PK from TAB2) order by BEDG_NR">tab2.t xt

    vimdiff tab1.txt tab2.txt

    it shoul work

    Comment

    Working...