Results 1 to 10 of 10

Thread: Select Count(*)

  1. #1
    Join Date
    May 2004
    Location
    Bordentown, NJ
    Posts
    27

    Unanswered: Select Count(*)

    Hi - We are using V7.2 on the MainFrame with z/OS

    When I issue a SELECT COUNT(*) FROM....

    I get a result of 0, when, in fact, there a 2 million rows.

    Any ideas????

  2. #2
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    See what "SELECT COUNT(1) FROM..." gives you.

  3. #3
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    I don't believe it....you in the right subsystem?

    Got the correct sqlid?
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  4. #4
    Join Date
    Mar 2004
    Location
    Toronto, ON, Canada
    Posts
    513
    Quote Originally Posted by ckintner
    Hi - We are using V7.2 on the MainFrame with z/OS

    When I issue a SELECT COUNT(*) FROM....

    I get a result of 0, when, in fact, there a 2 million rows.

    Any ideas????
    What does SELECT * FROM... give you?
    --
    Jonathan Petruk
    DB2 Database Consultant

  5. #5
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    If you submit:

    SELECT COUNT(*) FROM table-name

    it will give you the row count. If you have have anything after the "table-name" then you need to remove it.

    Don't try SELECT * FROM table-name on a table with 2 million rows, unless you add SELECT FIRST n ROWS to the end of the statement.
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

  6. #6
    Join Date
    May 2004
    Location
    Bordentown, NJ
    Posts
    27

    Corrupt Indexes

    The indexes for this table were corrupt. After I dropped/recreated them, the table was fine. It seems as if the pri/sec qty values were 720 and 720, which is not very much room. So, when an index runs out of room, doesn't DB2 give you some kind of message??????

  7. #7
    Join Date
    Apr 2004
    Location
    Inside Intel
    Posts
    165

    Talking

    Check the db2diag.log for error messages.

    Newbie

  8. #8
    Join Date
    Feb 2004
    Posts
    25
    There's no db2diag.log on the mainframe.

  9. #9
    Join Date
    Apr 2004
    Location
    Inside Intel
    Posts
    165

    Talking

    Accept my apologies..... I am curious how does a developer know the errors? Anyone?

    Newbie

  10. #10
    Join Date
    Feb 2004
    Posts
    25
    SQL codes will be returned to a COBOL (for example) program, or if using SPUFI (dynamic SQL query tool), the SQL code is returned back to the screen. Also, SQL codes are logged in the console output for the DB2 MSTR region.

Posting Permissions

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