Index
2015-03-01 14:53Joe Yoder : Scanning through the tables in a database
2015-03-01 15:23Jean MAURICE : Re: Scanning through the tables in a database
2015-03-01 15:26Michael Glassman : Re: Scanning through the tables in a database
Back to top
Scanning through the tables in a database

Author: Joe Yoder

Posted: 2015-03-01 14:53:00   Link

I want to get the number of records in each of the tables in a database.

When I open the .dbc file as a table I can scan for ObjectType = 'Table'

and get the names but when I try to do a "select cnt(*) from (objectname)

into array Cnt" I get the message that "The database for table ... could

not be opened. Would you like to try to locate the owning database or

delete the link (and free the table)?

Apparently if the DBC is open as a table it cannot be opened as a database

and the system will not let a file linked to a database be opened if the

database cannot be opened as well.

There are a number of workarounds that I can think of but I'm wondering -

Is there is a way to scan through the files in a database while the DBC is

open as a database?

Thanks in advance,

Joe

--- StripMime Report -- processed MIME parts ---

multipart/alternative

text/plain (text body -- kept)

text/html

---

_______________________________________________

Post Messages to: ProFox@leafe.com

Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox

OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech

Searchable Archive: http://leafe.com/archives/search/profox

This message: http://leafe.com/archives/byMID/profox/CABQeDnWzWwAGnMdtn+skcjDHb9EjaVUupvQua-Y8vxy-FOb5ZQ@mail.gmail.com

** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

©2015 Joe Yoder
Back to top
Re: Scanning through the tables in a database

Author: Jean MAURICE

Posted: 2015-03-01 15:23:45   Link

Hi Joe,

you can use ADBOBJECT() to get all the tables of a database in an array as in

the example given in the help :

* Open sample testdata database

OPEN DATABASE (HOME(2) + 'Data\testdata')

* Function call with cSetting for table names

=ADBOBJECTS(gaTables, "TABLE")

* Displays array gaTables created by ADBOBJECTS( ) function

DISPLAY MEMORY LIKE gaTables

In fact, ADBOBJECT will give you the number of element found :

lnnbtable = ADBOBJECT(gatables, "TABLE")

FOR lnindice = 1 TO m.lnnbtables

USE (gatables(m.lnindice,1))

? gatables(m.lnindice,1)+ STR(RECCOUNT(),8)

USE

NEXT

The Foxil

_______________________________________________

Post Messages to: ProFox@leafe.com

Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox

OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech

Searchable Archive: http://leafe.com/archives/search/profox

This message: http://leafe.com/archives/byMID/profox/54F38361.8000500@wanadoo.fr

** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

©2015 Jean MAURICE
Back to top
Re: Scanning through the tables in a database

Author: Michael Glassman

Posted: 2015-03-01 15:26:49   Link

Why not copy the records with ObjectType = “Table” into a free table, close the .dbc table, then do a record count on each file listed in the free table?

Mike

--------------------------------------------------------------------------------

From: Joe Yoder

Sent: Sunday, March 01, 2015 1:53 PM

To: profoxtech@leafe.com

Subject: Scanning through the tables in a database

I want to get the number of records in each of the tables in a database.

When I open the .dbc file as a table I can scan for ObjectType = 'Table'

and get the names but when I try to do a "select cnt(*) from (objectname)

into array Cnt" I get the message that "The database for table ... could

not be opened. Would you like to try to locate the owning database or

delete the link (and free the table)?

Apparently if the DBC is open as a table it cannot be opened as a database

and the system will not let a file linked to a database be opened if the

database cannot be opened as well.

There are a number of workarounds that I can think of but I'm wondering -

Is there is a way to scan through the files in a database while the DBC is

open as a database?

Thanks in advance,

Joe

--- StripMime Report -- processed MIME parts ---

multipart/alternative

text/plain (text body -- kept)

text/html

---

[excessive quoting removed by server]

_______________________________________________

Post Messages to: ProFox@leafe.com

Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox

OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech

Searchable Archive: http://leafe.com/archives/search/profox

This message: http://leafe.com/archives/byMID/profox/A35C27CF806B49829F168BCB93E36EE9@Studio17

** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

©2015 Michael Glassman