
informix中怎样查看索引?
请教在informix中怎样能查到某个表中已有的索引?我看资料说建立主键和外键后会自动加上索引,所以想确认一下...
请教在informix中怎样能查到某个表中已有的索引?我看资料说建立主键和外键后会自动加上索引,所以想确认一下
展开
1个回答
展开全部
对于特殊字段,比如外键,主键,在不知道外键主键名的情况下,需要如下操作
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。
希望对你有帮助。
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。
希望对你有帮助。
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询