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-47
Displaying All Constraints on a Table
)
)
for read uncommitted access;
NUM_CONSTRAINTS
--------------------
2
Displaying All Constraints on a Table
This example displays all constraints for a given table.
>> set schema samdbcat.definition_schema_version_1200;
--- SQL operation complete.
>> select substring (o1.object_name, 1, 30) as
constraint_name,
case (t.constraint_type)
when 'C' then 'CHECK'
when 'F' then 'FOREIGN'
when 'P' then 'PRIMARY'
when 'U' then 'UNIQUE'
else 'UNKNOWN'
end as constraint_type
from objects o, tbl_constraints t, objects o1
where
o.object_name = 'CUSTOMER' and
o.object_name_space = 'TA' and
o.object_uid = t.table_uid and
t.constraint_uid = o1.object_uid and
o.schema_uid =
(select schema_uid
from nonstop_sqlmx_figaro.system_schema.schemata
where
schema_name = 'SALES' and
cat_uid =
(select cat_uid
from nonstop_sqlmx_figaro.system_schema.catsys
where cat_name = 'SAMDBCAT'
)
)
for read uncommitted access;
CONSTRAINT_NAME CONSTRAINT_TYPE
------------------------------ ---------------
CUSTOMER_815548234_9441 CHECK
CUSTOMER_693278234_9441 PRIMARY