My Assistant
![]() ![]() |
|
|
Mar 17 2004, 06:36 PM
Post
#1
|
|
|
UtterAccess Enthusiast Posts: 91 From: Portland, OR |
Hi,
Anyone have any code you could share or a utility I could buy, that will count all the records in each table in a database. Then write all data to a temp table. Thanks! |
|
|
|
Mar 17 2004, 07:42 PM
Post
#2
|
|
|
Head Wizard Posts: 14,857 From: South Carolina, USA |
Why would you want to do this? What exactly are you trying to do?
|
|
|
|
Mar 17 2004, 08:08 PM
Post
#3
|
|
|
UtterAccess Enthusiast Posts: 91 From: Portland, OR |
I am doing a detailed analysis for a client, and I need to know how many records there are in each table, so I can make intelligent recommendations.
|
|
|
|
Mar 17 2004, 09:12 PM
Post
#4
|
|
|
Head Wizard Posts: 14,857 From: South Carolina, USA |
I suppose you could use code to iterate through the tabledef collection and get the recordcound for each item in the collection.
|
|
|
|
Mar 18 2004, 12:03 AM
Post
#5
|
|
|
UtterAccess VIP Posts: 2,128 From: San Jose, California |
Mark,
You can find an example of code that loops through the tabledef collection (excluding system tables) in the attachment found here. (You have to cobble together some code to count/record the rows in each table and substitute it for the "none-setting code" that is in the example, though.) And I can see why Jerry asked his question. Most clients that I've had usually want to tell ME how many rows are in their tables (several times, sometimes), not the other way around! HTH Jinky |
|
|
|
Mar 18 2004, 07:10 AM
Post
#6
|
|
|
Head Wizard Posts: 14,857 From: South Carolina, USA |
Another method you could use would be to create a simple UNION query using the following syntax:
SELECT "TableName1" AS TableName1, Count(*) AS NumRecords FROM TableName1 UNION SELECT "TableName2" AS TableName2, Count(*) AS NumRecords FROM TableName2 UNION SELECT "TableName3" AS TableName3, Count(*) AS NumRecords FROM TableName3 ....; This method would be "hardcoded" by you for each database you want to use it in. |
|
|
|
![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 18th May 2013 - 09:33 AM |