Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 967
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 Merging 2 records at multiple rows wi... Bijesh DFSORT/ICETOOL 2 Wed Dec 06, 2017 1:50 am
No new posts Can we combine the rows with same key... V S Amarendra Reddy DB2 12 Fri Dec 01, 2017 10:29 pm
No new posts Increment number for every group of r... srajendran2 DFSORT/ICETOOL 7 Thu Nov 09, 2017 10:31 pm
No new posts Update table without cursor Ron Klop DB2 3 Wed Oct 11, 2017 1:06 pm
No new posts Table(Unicode(Graphic) table) loading... muralikrishnan_new DB2 0 Thu Oct 05, 2017 5:10 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us