View previous topic :: View next topic
|
Author |
Message |
jwell rymbei
New User
Joined: 14 Dec 2005 Posts: 22 Location: India
|
|
|
|
hi,
our database have 220 tables. How can I count total number of columns in 220 tables. |
|
Back to top |
|
|
DavidatK
Active Member
Joined: 22 Nov 2005 Posts: 700 Location: Troy, Michigan USA
|
|
|
|
jwell rymbei,
I think you're going to have to do something like this
Code: |
SELECT SUM(A.R_C) AS TOTAL_ROW_COUNT
FROM
( SELECT COUNT(*) AS R_C FROM DB2.TABLE_1
UNION ALL SELECT COUNT(*) AS R_C FROM DB2.TABLE_2
UNION ALL SELECT COUNT(*) AS R_C FROM DB2.TABLE_3
UNION ALL SELECT COUNT(*) AS R_C FROM DB2.TABLE_4
) A
; |
Best of luck,
Maybe someone can come up with a better way that you don't have to list each table.
Dave, |
|
Back to top |
|
|
jwell rymbei
New User
Joined: 14 Dec 2005 Posts: 22 Location: India
|
|
|
|
select sum(colcount) from syscat.tables. i have tried with this and it worked fine. |
|
Back to top |
|
|
DavidatK
Active Member
Joined: 22 Nov 2005 Posts: 700 Location: Troy, Michigan USA
|
|
|
|
Hi jwell rymbei,
I just tried your query on my system and got an undefined name for "syscat.tables", Our systems must be set up differently.
Dave, |
|
Back to top |
|
|
prabs2006
Active User
Joined: 12 Jan 2006 Posts: 103
|
|
|
|
Hi David,
Can you please tell me how does ur above query work?
T & R
Prabs |
|
Back to top |
|
|
|