Query below finds all tables in all databases of Teradata Database instance that have 'code' column.
Query
SELECT TablesV.DatabaseName,
TablesV.TableName
FROM DBC.TablesV
INNER JOIN DBC.ColumnsV ON TablesV.DatabaseName = ColumnsV.DatabaseName
AND TablesV.TableName = ColumnsV.TableName
WHERE ColumnsV.ColumnName = 'code'
AND TablesV.TableKind = 'T'
ORDER BY TablesV.DatabaseName,
TablesV.TableName;
Columns
- DatabaseName - name of table's database where column was found in
- TableName - name of found table
Rows
- One row represents one table
- Scope of rows: all found tables
- Ordered by database & table name