IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Number of tables in a given database


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
senthil1711
Warnings : 1

New User


Joined: 27 Feb 2008
Posts: 10
Location: bangalore

PostPosted: Wed Mar 05, 2008 5:42 pm
Reply with quote

Hi,
How to know the number of TABLEs in a DB2 DATABASE...?
Is there any QUERY for that.?
Back to top
View user's profile Send private message
acevedo

Active User


Joined: 11 May 2005
Posts: 344
Location: Spain

PostPosted: Wed Mar 05, 2008 6:10 pm
Reply with quote

search in SYSIBM.SYSTABLES
Back to top
View user's profile Send private message
senthil1711
Warnings : 1

New User


Joined: 27 Feb 2008
Posts: 10
Location: bangalore

PostPosted: Thu Mar 06, 2008 10:19 am
Reply with quote

hi,

thanks.
could u plz tell where to search for SYSIBM.SYSTABLES. I tried but i can't access some of the options.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6248
Location: Mumbai, India

PostPosted: Thu Mar 06, 2008 11:52 am
Reply with quote

senthil1711 wrote:
I tried but..
Hi,

Where did You try..? If the next question is..
Quote:
could u plz tell where to search for SYSIBM.SYSTABLES
Back to top
View user's profile Send private message
senthil1711
Warnings : 1

New User


Joined: 27 Feb 2008
Posts: 10
Location: bangalore

PostPosted: Thu Mar 06, 2008 2:27 pm
Reply with quote

sorry..

the statement : "I tried but i can't access some of the options"--> is for...when i am trying to find where to look for "SYSIBM.SYSTABLES".. I tried some options where SPUFI and similar options are listed. Ex. for
"BMC ADMINISTRATIVE TOOLS FOR DB2" option I could not access it.

So, sorry for the confusion. If u know where to look for SYSIBM.SYSTABLES, plz write.
Back to top
View user's profile Send private message
stodolas

Active Member


Joined: 13 Jun 2007
Posts: 631
Location: Wisconsin

PostPosted: Thu Mar 06, 2008 7:37 pm
Reply with quote

SELECT xxx from SYSIBM.SYSTABLES WITH UR;
Back to top
View user's profile Send private message
senthil1711
Warnings : 1

New User


Joined: 27 Feb 2008
Posts: 10
Location: bangalore

PostPosted: Fri Mar 07, 2008 10:49 am
Reply with quote

Hi Steve

thank you
Back to top
View user's profile Send private message
jitendersinghbhiwani

New User


Joined: 15 Jun 2007
Posts: 2
Location: Chennai

PostPosted: Fri Mar 07, 2008 6:19 pm
Reply with quote

Hi,

Use the query
SELECT COUNT(*) From SYSIBM.SYSTABLES
WHERE CREATOR = 'XXXX'

in SPUFI or QMF. USE the DB2 region in place of XXXX where you want to find the tables.

If you want to get the list of tables then use SELECT * in place of SELECT COUNT(*)

ok
Back to top
View user's profile Send private message
senthil1711
Warnings : 1

New User


Joined: 27 Feb 2008
Posts: 10
Location: bangalore

PostPosted: Mon Mar 10, 2008 10:47 am
Reply with quote

hi jitender,

i used the query..

SELECT COUNT(*) From SYSIBM.SYSTABLES;

and it listed all the table names.

thanks.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6248
Location: Mumbai, India

PostPosted: Mon Mar 10, 2008 10:55 am
Reply with quote

senthil1711 wrote:
SELECT COUNT(*) From SYSIBM.SYSTABLES;

and it listed all the table names.
Hello,

This will return the count (number of) tables & not the list. For that
Code:
SELECT * From SYSIBM.SYSTABLES
with ur;
would work.
Back to top
View user's profile Send private message
senthil1711
Warnings : 1

New User


Joined: 27 Feb 2008
Posts: 10
Location: bangalore

PostPosted: Wed Mar 12, 2008 10:05 am
Reply with quote

hi anuj,

thanks
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10886
Location: italy

PostPosted: Wed Mar 12, 2008 12:36 pm
Reply with quote

Quote:
SELECT xxx from SYSIBM.SYSTABLES WITH UR;
will display the xxx column

Quote:
SELECT count(*) from SYSIBM.SYSTABLES WITH UR;
will display the TOTAL number of the tables in the DB2 instance irrelevant of the database

Quote:
SELECT DISTINCT DBNAME from SYSIBM.SYSTABLES ORDER BY DBNAME WITH UR;
will display all the DATABASES defined in the DB2 instance

Quote:
SELECT DBNAME count(*) FROM SYSIBM.SYSTABLES GROUP BY DBNAME ORDER BY DBNAME WITH UR;
will return a list of all the databases with the number of tables defined in each database

Quote:
SELECT DBNAME,TBNAME FROM SYSIBM.SYSTABLES ORDER BY DBNAME,TBNAME WITH UR;
will return a list of all the databases with the tables defined in each database
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Substring number between 2 characters... DFSORT/ICETOOL 2
No new posts Generate random number from range of ... COBOL Programming 3
No new posts Increase the number of columns in the... IBM Tools 3
No new posts What database does Jobtrac use CA Products 4
Search our Forums:

Back to Top