获取informix主键
我想得到informix中一个表的主键的名称,sql语句应该怎样写?回复 #1 xuanyuan000000 的帖子
SELECT constrname FROM sysconstraints WHERE tabid = (SELECT tabid FROM systablesWHERE tabname = ‘TabName’) and constrtype ='P'
[ 本帖最后由 3sane 于 2008-5-7 14:24 编辑 ] 原帖由 3sane 于 2008-5-7 14:22 发表 http://bbs.chinaunix.net/images/common/back.gif
SELECT constrname FROM sysconstraints WHERE tabid = (SELECT tabid FROM systables
WHERE tabname = ‘TabName’) and constrtype ='P'
这个只是得到约束的名字而已
回复 #3 xuanyuan000000 的帖子
constrtype ='P' 是主键约束,还有C 检查(Check)
R 引用(外键)(Reference,Foreign Key)
U 唯一性(Unique)
N 非空(Not Null) 恩。
[ 本帖最后由 ivhb 于 2008-5-9 09:56 编辑 ] 恩。主键在informix里面就是个 not null 的 unique index/unique contraint
页:
[1]