sqlssmssnowflake-cloud-data-platform

Searching all tables in database containing specific column


I am looking for a simple query to find all tables within a database that have a certain "id" column, confusing myself as not all the tables contain this "id"


Solution

  • Using INFORMATION_SCHEMA.COLUMNS:

    SELECT *
    FROM INFORMATION_SCHEMA.COLUMNS
    WHERE COLUMN_NAME = 'id'