473,804 Members | 2,257 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to select a table that has most columns using syscat?

hello,

how to select a table that has a highest amount of columns (compared
to other tables) using syscat?

thanks in advance

May 22 '07 #1
4 4722
Ian
d0m_at0m wrote:
hello,

how to select a table that has a highest amount of columns (compared
to other tables) using syscat?
I can't imagine how this would be useful, but:

select tabschema, tabname, count(*) as num_cols
from syscat.columns
group by tabschema, tabname
order by 3 desc
fetch first 1 row only;

May 22 '07 #2
On May 23, 4:30 am, d0m_at0m <2lazy2sl...@gm ail.comwrote:
hello,

how to select a table that has a highest amount of columns (compared
to other tables) using syscat?

thanks in advance
even this may work i think ..

select * from syscat.tables
where colcount=(selec t max(colcount) from syscat.tables)

May 23 '07 #3
On May 23, 4:54 am, Ian <ianb...@mobile audio.comwrote:
d0m_at0m wrote:
hello,
how to select a table that has a highest amount of columns (compared
to other tables) using syscat?

I can't imagine how this would be useful, but:

select tabschema, tabname, count(*) as num_cols
from syscat.columns
group by tabschema, tabname
order by 3 desc
fetch first 1 row only;
even it may work i think ..

select * from syscat.tables
where colcount=(selec t max(colcount) from syscat.tables)

May 23 '07 #4
situ wrote:
On May 23, 4:54 am, Ian <ianb...@mobile audio.comwrote:
>d0m_at0m wrote:
hello,
how to select a table that has a highest amount of columns (compared
to other tables) using syscat?

I can't imagine how this would be useful, but:

select tabschema, tabname, count(*) as num_cols
from syscat.columns
group by tabschema, tabname
order by 3 desc
fetch first 1 row only;

even it may work i think ..

select * from syscat.tables
where colcount=(selec t max(colcount) from syscat.tables)
SELECT *
FROM syscat.tables
ORDER BY colcount DESC
FETCH FIRST 1 ROW ONLY

--
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany
May 23 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
6475
by: Tcs | last post by:
My backend is DB2 on our AS/400. While I do HAVE DB2 PE for my PC, I haven't loaded it yet. I'm still using MS Access. And no, I don't believe this is an Access question. (But who knows? I COULD be wrong... :) I've tried the access group...twice...and all I get is "Access doesn't like ".", which I know, or that my query names are too long, as there's a limit to the length of the SQL statement(s). But this works when I don't try to...
10
6415
by: Jean | last post by:
Hi, how to know for a particular table if it is organized by index, and which one ? reorg table index ind1 -> the table is organised by ind1 i wan't to know that for all table thx
3
2784
by: selma | last post by:
I am puzzled by visual explain for a simple query ( select * from mytable ) chooses an index scan. That index has only a single column and the table has 30 columns not covered by the index. When running explain for another database (same schema structure), it showed table scan. These are all production databases with >10 GB of real data, and stats are all up to date. Reorgchk showed nothing bad. Per chance visual explain GUI was acting...
5
3568
by: Markus | last post by:
I created a Stored Procedure like this: CREATE PROCEDURE myProcedure(IN a_tabschema VARCHAR(20)) DYNAMIC RESULT SETS 1 LANGUAGE SQL BEGIN DECLARE rs CURSOR WITH RETURN FOR SELECT * FROM syscat.tables WHERE tabschema = a_tabschema; OPEN rs; END
7
1888
by: Bob Stearns | last post by:
Several weeks ago I asked what comments I could pass to DB2 in a SELECT statement. I don't remember whether I said via PHP/ODBC. I was assured that both /* */ style comment blocks and -- comment lines were allowed. Unfortunately, neither work. Both -- and /* */ comments cause a "premature end of statement". Any sage advice?
5
2182
by: Konstantin Andreev | last post by:
Recently I became interested, - Are the data, bulk loaded in the table with LOAD utility, consume the same disk space as loaded with IMPORT utility? The answer turned out to be NOT ! Here is a nutshell description of the test. The testing was done at "DB2/LINUX 8.2.3". Tables for tests: F4106 has 5203 rows, 32 columns. F42199 has 1399252 rows, 245 columns.
5
1845
by: RGow | last post by:
Hi all, Is there a way to retrieve or reconstruct the SQL that was used to create a particular table in DB2? I'm looking for something similar to the contents of the 'SYSCAT.ROUTINES.TEXT', but for tables. Thanks, Ryan Gow
4
7205
by: Chris | last post by:
Can't seem to figure out how to do this and have been reading for some time now...... I want to select a row count from a table name in SYSTABLES. This statement does not return what I needed, but can help explain what I'm looking for. I want the results to be the Row Count from a Table Name out of the Sub-Select. Select Count(*) from
2
5009
by: Okonita | last post by:
Hi all, How can I implement using REORGCHK to tell REORG what DB2 UDB v8 tables, etc to perform REORG on? Any example script will be highly appreciated. Okonita
0
9714
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9594
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10599
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10347
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10090
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9173
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7635
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
2
3832
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.