SQL/MX 3.2.1 Management Manual (H06.26+, J06.15+)
>> select count(*) as num_constraints
from tbl_constraints t,
objects o
where t.table_uid = o.object_uid
and o.object_name = 'CUSTOMER'
and o.schema_uid =
(select schema_uid
from nonstop_sqlmx_<sys name>.system_schema.schemata
where
schema_name = 'SALES' and
cat_uid =
(select cat_uid
from nonstop_sqlmx_<sys name>.system_schema.catsys
where cat_name = 'SAMDBCAT'
)
)
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_<schema version>;
--- 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_<sys name>.system_schema.schemata
where
schema_name = 'SALES' and
cat_uid =
(select cat_uid
from nonstop_sqlmx_<sys name>.system_schema.catsys
where cat_name = 'SAMDBCAT'
)
)
for read uncommitted access;
CONSTRAINT_TYPE
---------------
CONSTRAINT_NAME
------------------------------
CHECK
PRIMARY
CUSTOMER_412443172_5188
CUSTOMER_817253172_5188
Displaying Constraint Information 137










