Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to find out the total number of rows in a DB2 table?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
sabyasachi

New User


Joined: 31 Aug 2006
Posts: 3

PostPosted: Tue Mar 27, 2007 5:27 am    Post subject: How to find out the total number of rows in a DB2 table?
Reply with quote

Back to top
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Mar 27, 2007 5:45 am    Post subject:
Reply with quote

Hello,

You can use SELECT COUNT(*) in your DB2 query.
Back to top
View user's profile Send private message
harshadeshpande

New User


Joined: 23 Mar 2007
Posts: 5
Location: United States

PostPosted: Tue Mar 27, 2007 10:35 am    Post subject:
Reply with quote

If you have FILEAID tool then give your table name and in the NUMBER OF ROWS QUALIFIED give *
Back to top
View user's profile Send private message
Phrzby Phil

Active Member


Joined: 31 Oct 2006
Posts: 962
Location: Richmond, Virginia

PostPosted: Tue Mar 27, 2007 5:40 pm    Post subject:
Reply with quote

If your table is huge, SELECT COUNT(*) may not be preferable.

The SYSIBM.SYSTABLES table has this column:

CARDF
Total number of rows in the table or total number of LOBs in an auxiliary table. The value is -1 if statistics have not been gathered or the row describes a view, alias, or created temporary table. This is an updatable column
Back to top
View user's profile Send private message
vini_srcna

Active User


Joined: 26 May 2005
Posts: 178
Location: Copenhagen, Denmark

PostPosted: Tue Mar 27, 2007 8:05 pm    Post subject:
Reply with quote

Quote:
The SYSIBM.SYSTABLES table has this column:


In that case, you may have to check the STATS time. when is the last time statistics was taken. If there is some real time activity against this tables, then this count may not be accurate.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts find RACF group for access to spooled... jzhardy JCL & VSAM 1 Mon May 08, 2017 11:46 am
No new posts DSNACCOX (can it be run on 1 db/ts, t... SRICOBSAS DB2 3 Sat May 06, 2017 12:59 am
No new posts SMTP the current generation number of... Jyothi Kulunde JCL & VSAM 4 Thu May 04, 2017 4:08 pm
No new posts To find out size allocated to a seque... ashek15 JCL & VSAM 15 Thu Apr 27, 2017 9:42 am
No new posts unload data from table with lob columns farhad_evan DB2 0 Sat Apr 22, 2017 1:32 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us