Simple Query Questions

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • zhif
    New Member
    • Oct 2006
    • 8

    Simple Query Questions

    I just got the following questions

    Q1. How can I create a list of tables in LETMAP with the row counts of each?

    Q2. How can I get the database LETMAP's space? and the each table's space in LETMAP?

    LETMAP is database name.

    For Q1, I tried to use
    db2 "select tabschema, tabname, (select count(*) from tabschema.tabna me) from syscat.tables"

    When I execute this command, it comes with the error message said,
    SQL0204N "tabschema.tabn ame" is an undefined name.

    I know the problem is happened on the part of (select count(*) from tabschema.tabna me).
    How can I modify my query?

    Can I add something in the above query for the Q2 at same time? Or any idea that I can get Q2's information?

    Thanks a lot.
  • kalexin
    New Member
    • Apr 2007
    • 20

    #2
    Originally posted by zhif
    I just got the following questions

    Q1. How can I create a list of tables in LETMAP with the row counts of each?

    Q2. How can I get the database LETMAP's space? and the each table's space in LETMAP?

    LETMAP is database name.

    For Q1, I tried to use
    db2 "select tabschema, tabname, (select count(*) from tabschema.tabna me) from syscat.tables"

    When I execute this command, it comes with the error message said,
    SQL0204N "tabschema.tabn ame" is an undefined name.

    I know the problem is happened on the part of (select count(*) from tabschema.tabna me).
    How can I modify my query?

    Can I add something in the above query for the Q2 at same time? Or any idea that I can get Q2's information?

    Thanks a lot.

    The way I would do it is to create a stored procedure to receive table name and schema name as inputs and then return the table row count as ouput.
    Invoke this stored procedure from the query that selects from syscat

    Comment

    Working...