2014-08-27

Teradata - Database, table and columns inventory query

SELECT
       T.DatabaseName
       , T.TableName
       , T.TableKind
       , C.*
FROM
       dbc.tablesX T
       inner join
       dbc.columnsX C
       on
       T.DatabaseName = C.Databasename
       and T.TableName = C.Tablename
where

       1=1
      
       -- Access count
       --T.AccessCount is not null
      
       -- Filter in/out databases you don't want to inspect
       /*and T.DatabaseName NOT in (
''
       )*/
      
       -- Request text?
       --and T.RequestText LIKE '%TERM_HERE%'
      
       -- Filter for column names of interest
       --and C.ColumnName like '%PARTIAL_COLUMN_NAME_HERE%'
      
ORDER BY
       T.DatabaseName
       , T.TableName
       , C.ColumnName

;

No comments:

Post a Comment