Consultor Eletrônico



Kbase P92635: How to list all tables from all databases connected
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   17/10/2006
Status: Unverified

GOAL:

How to list all tables from all databases connected

GOAL:

How to list all tables when connected to multiple database

GOAL:

How to list table information when connected to multiple databases

FIX:

Running the following code lists all the user data tables of all the currently connected databases. The list will be output to the TableList.txt file:
DEFINE VARIABLE cCurrentDatabase AS CHARACTER NO-UNDO.
DEFINE VARIABLE iNumConnectedDBs AS INTEGER NO-UNDO.
OUTPUT TO TableList.txt.
DO iNumConnectedDBs = 1 TO NUM-DBS:
cCurrentDatabase = LDBNAME(iNumConnectedDBs).
PUT UNFORMATTED "Listing tables for " cCurrentDatabase SKIP.
CREATE ALIAS "DICTDB" FOR DATABASE VALUE(cCurrentDatabase).
RUN ListTables.p.
PUT UNFORMATTED FILL('*', 30) SKIP.
DELETE ALIAS dictdb.
END.
OUTPUT CLOSE.
Where ListTables.p is the following external procedure:
FOR EACH DICTDB._file NO-LOCK WHERE DICTDB._file._Tbl-Type = "T":
PUT DICTDB._file._file-name SKIP.
END.