![](//teradataforum.com/imgs/ptdfw1.gif) |
![](//teradataforum.com/imgs/ptdfw2.gif) |
Archives of the TeradataForum
Message Posted: Thu, 17 Jan 2013 @ 11:30:28 GMT
Subj: | | Compare 2 tables in 2 different databases |
|
From: | | Bakthavachalam, Roopalini |
Hi Forum,
I have 2 databases with 100 odd tables and would like to generate a report on the structure discrepancies which includes ( column names ,type,
index, column length?.). One crude way , I was thinking , was to run the ?SHOW TABLE? for all the tables in a bteq script and compare the
outputs. Another way was with a query below. Could anyone give me suggestions of any better way. I am sure there is!
SELECT
TABLENAME,
COLUMNNAME,
COLUMNFORMAT,
COLUMNTITLE,
COLUMNTYPE,
COLUMNLENGTH,
NULLABLE
FROM
DBC.COLUMNS
WHERE DATABASENAME = 'DEV_ABC'
MINUS
SELECT
TABLENAME,
COLUMNNAME,
COLUMNFORMAT,
COLUMNTITLE,
COLUMNTYPE,
COLUMNLENGTH,
NULLABLE
FROM
DBC.COLUMNS
WHERE DATABASENAME = 'PRD_ABC'
Thanks
Roopalini
| |