DB2 Query to retrieve all table names for a given schema

后端 未结 13 2162
难免孤独
难免孤独 2020-12-04 17:01

I\'m just looking for a simple query to select all the table names for a given schema.

For example, our DB has over 100 tables and I need to find any table that cont

相关标签:
13条回答
  • 2020-12-04 17:07

    You can also get the table names simply by typing LIST TABLES in DB2

    0 讨论(0)
  • 2020-12-04 17:08
    SELECT
      name
    FROM
      SYSIBM.SYSTABLES
    WHERE
        type = 'T'
      AND
        creator = 'MySchema'
      AND
        name LIKE 'book_%';
    
    0 讨论(0)
  • 2020-12-04 17:11

    You should try this:

    select TABNAME from syscat.tables where tabschema = 'yourschemaname'";
    
    0 讨论(0)
  • 2020-12-04 17:14

    Using the DB2 commands (no SQL) there is the possibility of executing

    db2 LIST TABLES FOR ALL
    

    This shows all the tables in all the schemas in the database.

    ref: show all tables in DB2 using the LIST command

    0 讨论(0)
  • 2020-12-04 17:17
    DB2 LIST TABLES FOR SCHEMA <schema_name>
    
    0 讨论(0)
  • 2020-12-04 17:17
    select name from sysibm.systables 
    where name like '%ISP%' 
    and type = 'T'
    
    0 讨论(0)
提交回复
热议问题