If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Compare the contents of two tables

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-30-04, 17:07
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
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.
Reply With Quote
  #2 (permalink)  
Old 01-30-04, 17:22
dollar489 dollar489 is offline
Registered User
 
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

Quote:
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
Reply With Quote
  #3 (permalink)  
Old 01-30-04, 19:26
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
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.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On