|
Posted by cobolman on 07/10/07 05:43
I guess I need help on another one as well, ...
I'd like to do a select to find all the foreign keys of a given table,
and the foreign_key columns.. (Sybase).
This SQL gives me what I want :
Select a.foreign_table_id, a.foreign_key_id, a.primary_table_id,
b.foreign_column_id, b.primary_column_id, c.column_id
from SYS.SYSFOREIGNKEY a
JOIN SYS.SYSFKCOL b ON
a.foreign_table_id = b.foreign_table_id AND
a.foreign_key_id = b.foreign_key_id
where a.foreign_table_id= XXX
But, .. what I'd really like is to instead of the column_id's and
table_id's have the actual name. I can get this from systable and
syscolumn, but I'm not sure how to write the sql
Navigation:
[Reply to this message]
|