SQL/MX 2.x Installation and Management Guide (G06.24+, H06.03+)

Querying SQL/MX Metadata
HP NonStop SQL/MX Installation and Management Guide523723-004
8-50
Displaying All Columns in a Table
Displaying All Columns in a Table
This example displays all columns in the table SAMDBCAT.PERSNL.EMPLOYEE:
>> set schema samdbcat.definition_schema_version_1200;
--- SQL operation complete.
>> select substring(column_name, 1, 25) as column_name,
column_number
from cols c, objects o
where
c.object_uid = o.object_uid and
o.object_name = 'EMPLOYEE' and
o.object_type = 'BT' and
o.schema_uid =
(select schema_uid
from nonstop_sqlmx_figaro.system_schema.schemata
where
schema_name = 'PERSNL' and
cat_uid =
(select cat_uid
from nonstop_sqlmx_figaro.system_schema.catsys
where cat_name = 'SAMDBCAT'
)
)
order by column_number
for read uncommitted access;
COLUMN_NAME COLUMN_NUMBER
------------------------- -------------
EMPNUM 0
FIRST_NAME 1
LAST_NAME 2
DEPTNUM 3
JOBCODE 4
SALARY 5