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 09, 20181 min 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

Can CIOs meet today’s challenges and plan for tomorrow?

Can CIOs meet today’s challenges and plan for tomorrow?

Read the new white paper

April 21, 2025

4 min read

From the Great North to global innovation: How OpenText powers the future of tech

From the Great North to global innovation: How OpenText powers the future of tech

The beginning of the year is the perfect time to reflect on one’s successful journey and set our sights on the future. At OpenText, our…

February 28, 2025

3 min read

Why SAST + SCA is the key to protecting your organization in 2025

Why SAST + SCA is the key to protecting your organization in 2025

Software supply chain risk continues to rise—just last year we witnessed a staggering 156% year-over-year increase in malicious software supply chain attacks.

January 17, 2025

4 min read

Stay in the loop!

Get our most popular content delivered monthly to your inbox.