How to Query Progress Metaschema in SQL-92


1. List names of all tables
--The best method is to use SYSTABLES view
select tbl from sysprogress.SYSTABLES;
--or the old fashioned method using _file
select "_File-Name" from pub."_File";

-- this is the same as in Oracle -- SELECT TABLE_NAME FROM DBA_TABLES;

2. List name and data type of all fields of a table (ABC) --The best method is to use SYSCOLUMNS view select id '#',owner,col 'Name',coltype 'Data Type', width,dflt_value 'Initial' from sysprogress.SYSCOLUMNS c where c.tbl = 'ABC' order by id; -- Note sysprogress.SYSCOLUMNS.id corresponds not to the Order in ABL Data Dictionay but to _Field._Field-Physpos. -- And there is no Format in SQL -- Data Types are also of SQL type ( logical=bit ) --or the old fashioned method using _file and _field select "_order" '#', "_Field-Name" 'Name', "_Data-Type", "_Width" 'SQL format', "_format" 'Progress format' from PUB."_Field" where "_Field"."_File-Recid" = (select "_File"."rowid" from PUB."_file" where "_file-name" = 'ABC') order by "_order";

-- This is the same as in Oracle -- DESC ABC; 3. To create an index in area "Users" CREATE INDEX sessions_timestamp_idx ON easyask.sessions ("timestamp") AREA "Users"; here owner name is easyask timestamp is in quotes because it is reserved word 4. To create an inactive index in area "Users" use PRO_ACTIVE CREATE INDEX sessions_timestamp_idx ON easyask.sessions ("timestamp") AREA "Users" PRO_ACTIVE 'n';