select
fc_obj.name as CONSTRAINT_NAME
,i.name as UNIQUE_CONSTRAINT_NAME
from
sysobjects fc_obj
,sysreferences r
,sysindexes i
,sysobjects pc_obj
where
permissions(fc_obj.parent_obj) != 0
and fc_obj.xtype = 'F'
and r.constid = fc_obj.id
and r.rkeyid = i.id
and r.rkeyindid = i.indid
and r.rkeyid = pc_obj.id
----------------- Oracle -------------------
◆表信息
select * from all_tab_comments t
where owner='DBO'
◆列信息
select * from all_col_comments t
where owner='DBO'
◆主键、外键对照
select OWNER, CONSTRAINT_NAME, CONSTRAINT_TYPE,
TABLE_NAME, R_OWNER, R_CONSTRAINT_NAME
from all_constraints
where owner='DBO' and
(Constraint_Type='P' or Constraint_Type='R')
◆主键、外键信息
select *
from all_cons_columns
where owner='DBO'
order by Constraint_Name, Position
------------------------- Access ------------------------
//Access中的系统表MSysobjects存储属性的字段是二进制格式,
不能直接分析可以采用ADO自带的OpenSchema方法获得相关信息
//use ADOInt.pas
//po: TableName
//DBCon:TADOConnection
/ds:TADODataSet