informix中怎样查看索引?

来源:百度知道 编辑:UC知道 时间:2024/06/24 19:22:40
请教在informix中怎样能查到某个表中已有的索引?我看资料说建立主键和外键后会自动加上索引,所以想确认一下

对于特殊字段,比如外键,主键,在不知道外键主键名的情况下,需要如下操作
select constrname from sysconstraints where constrtype='R' and tabid= ( select tabid from systables where tabname = 'tst_1' ) ; ----'R'查找外键,'P'查找主键
------针对informix数据库-----------------------------------------------------------
ALTER TABLE yourtable DROP CONSTRAINT constrname;
yourtable :你要删除的约束所在的表名称;
constrname :你要删除的约束名称;
constrname的获得:
在informix数据库中有一个系统表:sysconstraints
该表中存储了数据库所有的约束的基本信息:
constrid :约束标示
constrname :约束名称
owner :owner的用户名称
tabid :表标示
constrtype :约束类型
取值:C(check constraint)、P(Primary key)、R(Referential)、U(Unique)、N(Not Null)其中R则是你所需要的。
idxname :索引名称
根据tabid从另一个系统表systables中检索tabname。

希望对你有帮助。