Is there a simple way to get a COUNT(*) for all tables in a schema in
DB2 LUW 9.0? 3 32210
--CELKO-- wrote:
Is there a simple way to get a COUNT(*) for all tables in a schema in
DB2 LUW 9.0?
Well, if the tables are mostly static and you have current statistics
OR your tables are very dynamic and you have sufficiently recent
statistics, selecting from the catalog works great:
select tabname, card from syscat.tables where tabschema =
'<schemaName>'
(noting that for very dynamic table sizes, the exact COUNT(*) isn't
often accurate in any case for long).
ChrisC wrote:
--CELKO-- wrote:
>Is there a simple way to get a COUNT(*) for all tables in a schema in DB2 LUW 9.0?
Well, if the tables are mostly static and you have current statistics
OR your tables are very dynamic and you have sufficiently recent
statistics, selecting from the catalog works great:
select tabname, card from syscat.tables where tabschema =
'<schemaName>'
(noting that for very dynamic table sizes, the exact COUNT(*) isn't
often accurate in any case for long).
.... otherwise you need to scribble up a stored proc with dynamic SQL
inside..
Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
On Apr 30, 6:41 pm, --CELKO-- <jcelko...@eart hlink.netwrote:
Is there a simple way to get a COUNT(*) for all tables in a schema in
DB2 LUW 9.0?
Depends on what you mean by simple, but it is pretty straightforward
to do it from a shell.
[lelle@53dbd181 Documents]$ for t in `db2 -x "select tabname from
syscat.tables where tabschema = 'LELLE' and type = 'T'"`; do db2
"select '$t', count(1) from lelle.$t"; done
1 2
-- -----------
T1 196608
1 record(s) selected.
1 2
---------------- -----------
EXPLAIN_INSTANC E 10
1 record(s) selected.
1 2
----------------- -----------
EXPLAIN_STATEME NT 20
1 record(s) selected.
[...]
/Lennart This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: LRW |
last post by:
Well, I have another question that's hard to ask, so I may end up over
explaining the question.
I have about 40 tables, all with a similar column structure. I want to be
able to search through every table for a keyword.
Is there a way to do that using, an array or next or something.
So like, all the table, say tbl_1, tbl_2, tbl_3 etc have let's say 3
columns. id, name, note for example. And I want to seach all 40 tables in
the name...
|
by: Alan Zhong |
last post by:
i am a beginner of database design, could anyone please help me to
figure out how to make these two tables work.
1) a "players" table, with columns "name", "age"
2) a "teams" table, which can have one OR two player(s)
a team also has a column "level", which may have values "A", "B",
or "C"
how do you build the "teams" table (the critical question is "do i
need to create two fields" for the maximum two possible players?")
|
by: Leo |
last post by:
I am trying to determine the changes an application makes to a database.
The plan is to copy the existing schema (active) to a reference schema, run
the application and then diff the table data between the reference and the
a active schema. I have found one software vendor who has a tool to do
this, but it will only do one table at a time (interactively); I have more
then 300 and will run this a few times.
One other way of determining...
|
by: Bing Wu |
last post by:
Hi all,
I am running a database containing large datasets:
frames: 20 thousand rows,
coordinates: 170 million row.
The database has been implemented with:
IBM DB2 v8.1
|
by: Atif |
last post by:
Hi
I am using MS Access 2000 and want to open the Schema to know about
Table's structures like column names, data types, primary keys etc.
In SQL Server, we use OpenSchema method of Connection object,
in Oracle, we use "desc table" query,
in MySQL, we use "describe table" query,
in MS Access, we use ???????.
| |
by: Rory Campbell-Lange |
last post by:
I have a number of web applications which have a large amount of their
logic written in plpgsql. For each particular application I have a
separate instance of a database. If I need to update functions I have to
connect to each database and then run \i fn_function_update.sql.
I imagined schemas might allow me to globally update functions across a
database hosting many schemas with the same structure. In this scenario
my webapp would...
|
by: shsandeep |
last post by:
What is the query to obtain a list of all the tables having the maximum
number of rows in descending order?
Cheers,
Sandeep.
|
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
|
by: r0cboff |
last post by:
Hi there, This is my first time posting in here and I'm hoping somebody can point out where I am going wrong?
I am currently trying to use Bitemporal tables. By this I mean a table with a valid times and transaction times. These topics are covered by Joe Celko and Richard Snodgrass in their respective books.
I have developed a simple schema to test the relevant constraints which are required to keep all the valid times and transaction...
|
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,...
|
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,...
| |
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...
|
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...
|
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...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |