2
我现在有2个查询(我已经从不同的网页采取在互联网上),它执行以下操作:加入查询
- 检索所有列给定表
- 检索PK和在给定的表
这些查询分别FK约束
select
c.colname,
c.coltype,
c.collength
from
syscolumns c,
systables t
where
t.tabname = 'user' and
c.tabid = t.tabid
select
c.colname,
c.colno,
o.constrtype
from
systables t,
sysconstraints o,
sysindexes i,
syscolumns c
where
t.tabname = 'user' and
c.tabid = t.tabid and
o.tabid = t.tabid and
i.tabid = t.tabid and
o.constrtype in ('R', 'P') and
o.idxname = i.idxname and
( colno = part1 or
colno = part2 or
colno = part3 or
colno = part4 or
colno = part5 or
colno = part6 or
colno = part7 or
colno = part8 or
colno = part10 or
colno = part9 or
colno = part11 or
colno = part12 or
colno = part13 or
colno = part14 or
colno = part15 or
colno = part16);
我想,这样的结果包含有类似 colname
,colno
,collength
,constrtype
加入这些查询在一起。我相信LEFT OUTER JOIN是我需要的,但我不太清楚如何形成它,所以任何帮助,将不胜感激。