Consultor Eletrônico



Kbase P15733: How to relate records in the _File with records in the _Field metaschema table in SQL-92?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   5/16/2008
Status: Verified

GOAL:

How to relate records in the _File with records in the _Field metaschema table in SQL-92?

GOAL:

How to get a list of all the field names belonging to a specific table in the Database schema using SQL92?

FACT(s) (Environment):

All Supported Operating Systems
Progress 9.x
OpenEdge 10.x

FIX:

For this purpose, Progress SQL-92 System Catalog tables can be used. More specifically the SYSTABLES.TBL and SYSCOLUMNS.TBL System Catalog Tables.

For example in 4GL you would do the following:
FIND FIRST _File WHERE _File-Name = "State".
FOR EACH _Field OF _File.
DISPLAY _File-Name _Field-Name.
END.

The equivalent in SQL-92 would be:

SELECT
SYSTABLES.TBL, SYSCOLUMNS.COL
FROM
SYSPROGRESS.SYSCOLUMNS , SYSPROGRESS.SYSTABLES
WHERE
SYSCOLUMNS.TBL = SYSTABLES.TBL
AND SYSTABLES.OWNER = 'PUB'
AND SYSTABLES.TBL = 'State';