If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Select Count(*)

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-14-04, 10:01
ckintner ckintner is offline
Registered User
 
Join Date: May 2004
Location: Bordentown, NJ
Posts: 27
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????
Reply With Quote
  #2 (permalink)  
Old 07-14-04, 10:11
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
See what "SELECT COUNT(1) FROM..." gives you.
Reply With Quote
  #3 (permalink)  
Old 07-14-04, 13:13
Brett Kaiser Brett Kaiser is offline
Window Washer
 
Join Date: Nov 2002
Location: Jersey
Posts: 10,303
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.
Reply With Quote
  #4 (permalink)  
Old 07-14-04, 15:00
J Petruk J Petruk is offline
Registered User
 
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
Reply With Quote
  #5 (permalink)  
Old 07-16-04, 23:35
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
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
Reply With Quote
  #6 (permalink)  
Old 07-19-04, 11:14
ckintner ckintner is offline
Registered User
 
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??????
Reply With Quote
  #7 (permalink)  
Old 07-19-04, 13:28
dsusendran dsusendran is offline
Registered User
 
Join Date: Apr 2004
Location: Inside Intel
Posts: 165
Talking

Check the db2diag.log for error messages.

Newbie
Reply With Quote
  #8 (permalink)  
Old 07-19-04, 13:36
crisscross crisscross is offline
Registered User
 
Join Date: Feb 2004
Posts: 25
There's no db2diag.log on the mainframe.
Reply With Quote
  #9 (permalink)  
Old 07-19-04, 14:17
dsusendran dsusendran is offline
Registered User
 
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
Reply With Quote
  #10 (permalink)  
Old 07-19-04, 14:21
crisscross crisscross is offline
Registered User
 
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.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On