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-56
Displaying the Attributes of a Column
Displaying the Attributes of a Column
This example displays some of the attributes of the columns in the table
SAMDBCAT.PERSNL.EMPLOYEE. To display additional attributes, select different
fields from the COLS table:
>> set schema samdbcat.definition_schema_version_1200;
--- SQL operation complete.
>> select substring(c.column_name, 1, 15) as column_name,
c.column_number as col_num,
c.sql_data_type,
case c.column_class
when 'S' then 'SYSTEM'
when 'U' then 'USER'
when 'A' then 'ADDED'
else 'OTHER'
end as col_class
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 COL_NUM SQL_DATA_TYPE COL_CLASS
--------------- ----------- ------------------ ---------
EMPNUM 0 UNSIGNED NUMERIC USER
FIRST_NAME 1 CHARACTER USER
LAST_NAME 2 CHARACTER USER
DEPTNUM 3 UNSIGNED NUMERIC USER
JOBCODE 4 UNSIGNED NUMERIC USER
SALARY 5 UNSIGNED NUMERIC USER