August 1, 2006 at 2:39 am
Hi!
Is there any way to query the parent table.column and the referenced table.column from a FK?
I'v been lurking with system tables and views but can't find this type of info.
Thanks so much!
August 1, 2006 at 3:35 am
Hi Miquel,
Try this:
select
object_name(constid) as constraint_name,object_name(fkeyid) as foreign_key_table,object_name(rkeyid) as referencing_table,col_name(fkeyid, fkey) as foreign_key_column,col_name(rkeyid, rkey) as referencing_columnfrom
sysforeignkeys
You can then filter your results by foreign key by using a WHERE clause on constid (which is the id of the foreign key)
Hope that helps,
August 1, 2006 at 3:51 am
Oh, thanks so much for the quick response.
sysforeignkeys !!!
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply