Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2002
    Posts
    35

    Unanswered: All Db2 tables rows, count

    HI,


    How to get the row count of all tables from sys.systables in one SQL or program other than typing each table one SQL.

    I mean taking each table and say count(*) instead is there a way to find exact way to find out the table row count(accurate row count).


    Thanks,
    vasu
    Last edited by k_vasu; 01-23-03 at 16:03.
    vasu

  2. #2
    Join Date
    Sep 2002
    Posts
    456

    Re: All Db2 tables rows, count

    Assuming you have the updated statistics on tables, you can query the syscat.tables view to find out the row count as:

    SELECT tabname, card FROM syscat.tables

    dollar


    Originally posted by k_vasu
    HI,


    How to get the row count of all tables from sys.systables in one SQL or program other than typing each table one SQL.

    I mean taking each table and say count(*) instead is there a way to find exact way to find out the table row count(accurate row count).


    Thanks,
    vasu

  3. #3
    Join Date
    Aug 2002
    Posts
    35
    Thanks for the help,

    But it is not showing the exact count number.

    Any suggestions.

    Thanks,
    vasu
    vasu

  4. #4
    Join Date
    Sep 2002
    Posts
    456
    As I mentioned in the previous reply you have to have the updated statistics, you can do that by running the REORG and RUNSTATS utilities on each table. Then you can run the select staement to get the count.

    dollar

    Originally posted by k_vasu
    Thanks for the help,

    But it is not showing the exact count number.

    Any suggestions.

    Thanks,
    vasu

Posting Permissions

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