How to get table properties?

hai,

I would like to get all the table properties(data dictionary).

Ex.
A table is created with three fields, with one as primary key.
field1 integer primary key.
field2 character
field3 decimal.

i would like to retrieve the which key is primary key, how many index that table has, what are the fields accompanied to form that index like that I need?
 

Casper

ProgressTalk.com Moderator
Staff member
OR:

Code:
DEFINE STREAM sOut.
OUTPUT STREAM sOut TO c:\temp\tables.txt.
FOR EACH _file WHERE _file._hidden = NO:
    PUT STREAM sOut UNFORMATTED _file._file-name  ' : ' _file._desc SKIP SKIP.
    FOR EACH _Index WHERE _index._file-recid = RECID(_file):
        PUT STREAM sOut UNFORMATTED '~t' _Index._index-name '~t'
               (IF RECID(_index) = _file._Prime-Index THEN 'Primary' ELSE '~t')
               '~t'
                STRING(_index._Unique,'Unique/') SKIP.
        FOR EACH _index-field WHERE _index-field._index-recid = RECID(_Index),
            FIRST _field WHERE RECID(_field) = _index-field._field-recid:
            PUT STREAM sOut UNFORMATTED '~t~t' _field._field-name '~t' 
                    _field._Data-type
                    STRING(_Index-field._ascending,'/DESC') SKIP.
        END.
    END.
    PUT STREAM sOut UNFORMATTED " " SKIP SKIP.
END.

Casper
 
Top