Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2009
    Posts
    26

    Unanswered: Is there any way to get the row count from System.catalog

    Hello Everyone,
    I am very new to DB2 and stared learning of it.
    I am using this following query to get the schema and table names from a data base

    String query="SELECT TABSCHEMA, TABNAME, TYPE, COLCOUNT, KEYCOLUMNS, KEYINDEXID, KEYUNIQUE FROM SYSCAT.TABLES WHERE TABSCHEMA NOT LIKE 'SYS%' AND TYPE = 'T' ";


    So my question is
    1)Is there any way to get the row count by using SYSCAT.TABLES.

    i tried this one
    SELECT ROWSIZE,TABSCHEMA, TABNAME, TYPE, COLCOUNT, KEYCOLUMNS, KEYINDEXID, KEYUNIQUE FROM SYSCAT.TABLES WHERE TABSCHEMA NOT LIKE 'SYS%' AND TYPE = 'T' ";


    But it did not execute it gave me this exception as follows.
    DB2 SQL Error: SQLCODE=-206, SQLSTATE=42703, SQLERRMC=ROWSIZE,


    Any help is really appreciated.

    Thanks in advance

    Regards,
    swati

  2. #2
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    Please refer to the SQL Reference Vol 1, Appendix D. System catalog views for a description of the SYSCAT.TABLES view. You will find a column in there that contains the number of rows in the table, but keep in mind that it is only updated after runstats utility is run on the table.
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

  3. #3
    Join Date
    Jul 2009
    Posts
    26
    Thanks a lot it got worked.....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •