Quantcast
Channel: Teradata Forums - Database
Viewing all articles
Browse latest Browse all 14773

Script to compare two databases (Tables and Views definitions) - response (1) by Raja_KT

$
0
0

Hi Khurram,
This script is not tested but I think you will get the logic easily.  You can customize and expand more as per your requirements. Once you get the output, you can open in excel sheet or write unix script to do comparison, according to your convenience:
 

.export....all what you need

........EXPORT REPORT FILE = abc.sql

select case when  when tablekind = 't' then 'show table '

                 when tablekind = 'v' then 'show view '

            end || trim(databasename) || '.' || trim(tablename) || ' ;' (title '')

       from dbc.tables  tbl_view

      where  tbl_view.tablekind in('t','v')

        AND DATABASENAME IN

            (

             'db1','db2'

            )

        and trim(tablename) not like all ('al%','et%','lt%','tl%','uv')

        and tbl_view.tablename not in

            ( select trim(childtable) || '_' || trim(indexid)

                 from dbc.all_ri_children

            )

      group by 1

      order by 1;

.EXPORT RESET

     .EXPORT REPORT FILE = abc.txt

     .RUN FILE abc.sql

     .EXPORT RESET

 

     .LOGOFF

     .QUIT

 

Cheers,

Raja


Viewing all articles
Browse latest Browse all 14773

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>