Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650

    Unanswered: Compare the contents of two tables

    What is the best way to compare the contents of two identical tables , ie, if table A and table B have the same structure and expected to have the same content, I'm looking at the best option to identify the rows that are different ...

    I'll have to do this comparison for about 30 tables, 10 of them have 60-70 thousand records ... Others are less than 10000

    DB2 V7.2 FP 9 on AIX 5.1

    Thanks

    Sathyaram
    Visit the new-look IDUG Website , register to gain access to the excellent content.

  2. #2
    Join Date
    Sep 2002
    Posts
    456

    Re: Compare the contents of two tables

    I did the same couple of months ago, where I wrote a script to export two tables (A and B) at one time and used diff utility to compare the content.

    dollar

    Originally posted by sathyaram_s
    What is the best way to compare the contents of two identical tables , ie, if table A and table B have the same structure and expected to have the same content, I'm looking at the best option to identify the rows that are different ...

    I'll have to do this comparison for about 30 tables, 10 of them have 60-70 thousand records ... Others are less than 10000

    DB2 V7.2 FP 9 on AIX 5.1

    Thanks

    Sathyaram

  3. #3
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650

    Re: Compare the contents of two tables

    Thanks Dollar ...
    I cannot do that because I have fields >254 chars to comapre ... Export Del truncates these column values


    I just found an option I think will suit my volumes of data ...

    SELECT * FROM TAB1
    EXCEPT
    SELECT * FROM TAB2
    ;

    SELECT * FROM TAB2
    EXCEPT
    SELECT * FROM TAB1
    ;


    Will be testing it on Monday


    For higher volumes, this may 'crawl'

    cheers
    Sathyaram
    Visit the new-look IDUG Website , register to gain access to the excellent content.

Posting Permissions

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