|
On Tue, 22 Nov 2005 13:19:13 -0500, Lorne Klassen <lk1@ROGERS.COM> wrote:
>I have a table that has a primary key. There are a number of foreign keys
>in other tables (sometimes >1 column in a given table) that reference this
>primary key. I need to write code that involves the primary key and all of
>these foreign keys in other tables. I could hardcode all of this code.
>However, I do not want to hard code it considering how many tables and
>columns are involved. I would like a systematic way of finding out what
>columns from what tables reference this primary key. I searched the
SASHELP
>views, thinking that SAS would have this information there but it doesn't.
>Any ideas? Thanks in advance for replies.
sashelp.vrefcon provides info on referential integrity constraints.
sashelp.vindex is also worth a look
It identifies indexes in any indexed tables in any assigned libraries.
Tables without referential integrity constraints may still be of
interest where columns with consistent data names and types join to
indexes in other tables.
Of course, you may have undocumented referential integrity which uses
different names in the primary and "foreign" keys.
I see no way to automate identification of these cases.
Good Luck
Peter
|