Find Which Tables Have a Particular Column Name: Quick Tip

Your Vertica database probably contains hundreds, if not thousands, of tables. Trying to remember which tables contain a certain column can be a daunting task….

OpenText profile picture
OpenText

October 9, 20181 minute read

Shot of a young computer programmer working on source code

Your Vertica database probably contains hundreds, if not thousands, of tables. Trying to remember which tables contain a certain column can be a daunting task. Instead, query the V_CATALOG.COLUMNS system table!

Example:

Which tables have a column named “DateKey”?

dbadmin=> SELECT table_schema, table_name, column_name
dbadmin-> FROM v_catalog.columns
dbadmin-> WHERE column_name = 'DateKey'
dbadmin-> ORDER BY 1, 2, 3;
table_schema | table_name | column_name
--------------+-------------------------+-------------
warehouse | BridgeCustomerAccount | DateKey
warehouse | BridgeHouseholdCustomer | DateKey
warehouse | DimDate | DateKey
warehouse | FactAccount | DateKey
warehouse | FactAccountScore | DateKey
warehouse | FactCustomer | DateKey
warehouse | FactCustomerScore | DateKey
warehouse | FactHousehold | DateKey
warehouse | FactHouseholdScore | DateKey
(9 rows)

Which tables have a column with a name that contains the text “ssn”?

dbadmin=> SELECT table_schema, table_name, column_name
dbadmin-> FROM v_catalog.columns
dbadmin-> WHERE column_name ILIKE '%ssn%';
table_schema | table_name | column_name
--------------+---------------+-------------
public | employee_fact | ssn
dw | emp_dim | SSN
(2 rows)

Have fun!

Share this post

Share this post to x. Share to linkedin. Mail to
OpenText avatar image

OpenText

OpenText, The Information Company, enables organizations to gain insight through market-leading information management solutions, powered by OpenText Cloud Editions.

See all posts

More from the author

Manutan combines digital services with the human touch to delight customers

Manutan combines digital services with the human touch to delight customers

At Manutan, we equip businesses and communities with the products and services they require to succeed. Headquartered in France, our company has three divisions, serving…

4 minute read

Reaching new markets in Europe and beyond

Reaching new markets in Europe and beyond

How information management specialists at One Fox slashed time to market for innovative products with OpenText Cloud Platform Services At One Fox, we’ve driven some…

4 minute read

SoluSoft helps government agencies tackle fraud faster

SoluSoft helps government agencies tackle fraud faster

Fraud, in all its forms, is a pervasive problem, spanning industries and preying on vulnerabilities in federal and state government systems. Each year in the…

3 minute read

Stay in the loop!

Get our most popular content delivered monthly to your inbox.