Find a table by the name in Teradata database

Query below finds tables with specific name in all databases of Teradata Database. In this case it searches for 'Countries' table.

Query

SELECT  DatabaseName,
        TableName
FROM    DBC.TablesV
WHERE   TableKind = 'T'
AND     TableName = 'Countries'
ORDER BY    DatabaseName;

Columns

  • DatabaseName - name of database where table was found in
  • TableName - name of table (redundant as it should be exactly the same as provided)

Rows

  • One row represents one table
  • Scope of rows: all found tables
  • Ordered by database name

Notes

There might be more tables than one because different databases can have tables with the same names.

Sample results