Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Foreign key columns

Author  Topic 

scelamko
Constraint Violating Yak Guru

309 Posts

Posted - 2008-02-05 : 18:19:32
Guys,

Below is the query that I use to generate foreign key name, child table and parent table, but I would also like to add parent and child columns which are part of the relationship to the select list.

select o.name, a.name as child, b.name as parent
from sysobjects o inner join sysforeignkeys f
on f.constid = o.id inner join sysobjects a on a.id = f.fkeyid
inner join sysobjects b on b.id = f.rkeyid

Is there anyway to do this

Any comments and suggestions would help

Thanks

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2008-02-05 : 23:03:13
Checked information_schema.CONSTRAINT_COLUMN_USAGE?
Go to Top of Page
   

- Advertisement -