comparing 2 Teradata tables with different structure

Tools
Enthusiast

comparing 2 Teradata tables with different structure

Hi All,

I have to compare 2 tables having different structure,i.e. in one table there are some additional columns at the end. I have to do a sample record comparison . Please suggest if Minus query will work.

Also, suggest how I can highlight the mismatched data. Earlier, I was using a manual process by exporting the records into excel and then comapring and highlighting the data values. Can it be possible that the mismatched values are highlighted by comparing in teradata.

Thanks in Advance!

2 REPLIES
Enthusiast

Re: comparing 2 Teradata tables with different structure

A minus will work for comparing the data in the columns from table1 to table2 on columns that exist on both.

For extra columns you can also use minus.

Sel columnname from dbc.columnsv where databasename = dbname and tablename = 'table1'

minus

Sel columnname from dbc.columnsv where databasename = dbname and tablename = 'table2';

Top query must have table with extra columns.

Rglass

Enthusiast

Re: comparing 2 Teradata tables with different structure

Hi Rglass,

Many Thanks for your reply.

I am planning to use the below approach :

  1. using dbc.columnsv, get all the columns into a unix file
  2. prepare minus query for unique key,(each) column by reading the unix file. so that I get the result for each mismatched column in a new row
  3. execute the minus query using BTEQ

Please suggest any modification/improvements to the above approach.