GBase 8s
其他
文章
GBase 8s 查看库里所有表的表名和主键名
发表于2026-04-21 10:40:2880次浏览9个评论
GBase 8s查看库里所有表的表名和主键名
select t.tabname,col.colname
from systables t, sysconstraints c,sysindexes i,syscolumns col
where t.tabid = c.tabid
and t.tabid > 99
and c.constrtype = 'P'
and c.idxname = i.idxname
and t.tabid = col.tabid评论
登录后才可以发表评论
柒柒天晴发表于 3个月前
111
柒柒天晴发表于 3个月前
学习下
GBase用户19279发表于 3个月前
学习
GBase用户47954发表于 3个月前
感谢作者的精彩分享!
郝老师发表于 3个月前
666
曾云林发表于 2个月前
来了
GBase用户51934发表于 2个月前
来了
热门帖子
- 12025-12-01浏览数:182759
- 22023-05-09浏览数:25052
- 42023-09-25浏览数:18521
- 52020-05-11浏览数:17526
select t.tabname,c.constrname,
rtrim((select c.colname from syscolumns c where c.tabid = t.tabid and c.colno = abs(i.part1)) || ',' ||
(select c.colname from syscolumns c where c.tabid = t.tabid and c.colno = abs(i.part2)) || ',' ||
(select c.colname from syscolumns c where c.tabid = t.tabid and c.colno = abs(i.part3)) || ',' ||
(select c.colname from syscolumns c where c.tabid = t.tabid and c.colno = abs(i.part4)) || ',' ||
(select c.colname from syscolumns c where c.tabid = t.tabid and c.colno = abs(i.part5)) || ',' ||
(select c.colname from syscolumns c where c.tabid = t.tabid and c.colno = abs(i.part6)) || ',' ||
(select c.colname from syscolumns c where c.tabid = t.tabid and c.colno = abs(i.part7)) || ',' ||
(select c.colname from syscolumns c where c.tabid = t.tabid and c.colno = abs(i.part8)) || ',' ||
(select c.colname from syscolumns c where c.tabid = t.tabid and c.colno = abs(i.part9)) || ',' ||
(select c.colname from syscolumns c where c.tabid = t.tabid and c.colno = abs(i.part10)) || ',' ||
(select c.colname from syscolumns c where c.tabid = t.tabid and c.colno = abs(i.part11)) || ',' ||
(select c.colname from syscolumns c where c.tabid = t.tabid and c.colno = abs(i.part12)) || ',' ||
(select c.colname from syscolumns c where c.tabid = t.tabid and c.colno = abs(i.part13)) || ',' ||
(select c.colname from syscolumns c where c.tabid = t.tabid and c.colno = abs(i.part14)) || ',' ||
(select c.colname from syscolumns c where c.tabid = t.tabid and c.colno = abs(i.part15)) || ',' ||
(select c.colname from syscolumns c where c.tabid = t.tabid and c.colno = abs(i.part16)), ','
) as pkcollist
from systables t, sysconstraints c,sysindexes i
where t.tabid = c.tabid
and t.tabid > (select tabid from systables where tabname = ' VERSION')
and c.constrtype = 'P'
and c.idxname = i.idxname;