用于主键信息列的derby系统表

时间:2013-12-05 09:39:18

标签: derby

我正在尝试从系统表中检索PK列,并查看文档,我看不到如何获取该信息。 SYS.SYSCONSTRAINTS不包含列信息。

我想知道哪个列属于主键。我在sys模式中找到表,然后我可以获得所有主键信息。 SQL是:

select t.tablename,
conglomeratename backIdxName,
cst.constraintname,
cst.type
from sys.systables   t,
sys.sysconstraints   cst,
sys.sysconglomerates cgl,
sys.syskeys          sk
where isindex = 'TRUE'
and cgl.tableid = t.tableid
and (sk.constraintid = cst.constraintid and cst.type = 'P' and
sk.conglomerateid = cgl.conglomerateid)
and t.tableid = cst.tableid
and t.tabletype = 'T'

所有主键都是查询输出,但我想知道主键和列之间的关系。我不知道该列属于哪个主键。我找到sys.syscolumns表但没有用。

有谁知道吗?

感谢。

0 个答案:

没有答案
相关问题