PDA

Click to See Complete Forum and Search --> : Table Dependencies


DesertChip
Jul 5th, 2000, 08:33 AM
I have some master tables that other tables reference their PK as a forign key. Good example is "Cities" tables that can be referenced from "Customers" and "Suppliers" tables.

Now, the question is, is there a away to get a list of those tables that reference "Cities" ??

I'm using SQL server 7.0, ADO 2.5

Regards

RogerH
Jul 5th, 2000, 09:26 AM
exec sp_depends 'tablename'

Roger

DesertChip
Jul 5th, 2000, 09:59 AM
Ok, I found the answer in another site, here it is:

SELECT Name FROM SYSOBJECTS,SYSREFERENCES
WHERE ID = FKEYID
AND RKEYID = (SELECT ID FROM sysobjects WHERE Name = TableName