List views in Teradata database

Query below lists all views in Teradata databases excluding system ones.

Notes

Query may not exclude all system databases as this list depends on the Teradata Database configuration.

Query

SELECT  DataBaseName,
        TableName as ViewName,
        CreatorName,
        CreateTimeStamp as Created,
        RequestText as Definition
FROM    DBC.TablesV
WHERE   TableKind = 'V'
AND DataBaseName NOT IN ('All', 'Crashdumps', 'DBC', 'dbcmngr', 
    'Default', 'External_AP', 'EXTUSER', 'LockLogShredder', 'PUBLIC',
    'Sys_Calendar', 'SysAdmin', 'SYSBAR', 'SYSJDBC', 'SYSLIB', 
    'SystemFe', 'SYSUDTLIB', 'SYSUIF', 'TD_SERVER_DB',  'TDStats',
    'TD_SYSGPL', 'TD_SYSXML', 'TDMaps', 'TDPUSER', 'TDQCD',
    'tdwm',  'SQLJ', 'TD_SYSFNLIB',  'SYSSPATIAL')
ORDER BY    DatabaseName,
            TableName;

Columns

  • DataBaseName - database name
  • ViewName - view name
  • CreatorName - creator name
  • Created - create datetime of the view
  • Definition - definition (script) of the view

Rows

  • One row represents one view in a database
  • Scope of rows: all views in non system databases
  • Ordered by database name, view name

Sample results