Search code examples
sqldb2database-schema

SQL query to get all the heading names under a specific schema name


SQL query to headings from 'Table' under a specific schema name.

Schema_name
      - Table

      - View

SELECT TABNAME FROM syscat.tables where tabschema = 'SCHEMA-NAME'

Above sql prints out all the tables names in both 'Table' and 'View' but I just want the table names under 'Table'


Solution

  • Try using an additional filter

       WHERE TYPE = 'T'
    

    this will limit your result to tables.

    More details can be found here