views:

32

answers:

1

In SQL Server is there a command to return a list of all tables with a relationship to a given table or view?

EDIT: SQL SERVER 2008

+1  A: 

For SQL Server 2005 and up, use something like:

SELECT
    name, OBJECT_NAME(parent_object_id) 'Table'
FROM 
    sys.foreign_keys
WHERE 
    referenced_object_id = OBJECT_ID('Your-referenced-table-name-here')
marc_s