locked
"Orphaned" Foreign Keys RRS feed

  • Question

  • I am currently working with two SQLServer databases whose origins are WAY before my time.  Actually, at one time I believe the two databases were one, but were then divided.  I don't know which version(s) of SQLServer was used to create them.  Over time there have been many modifications to the data model.  While trying to identify the foreign key relationships in each database, I compiled a list that apparently shows many "orphaned" foreign keys.  Selecting the rows from sys.objects where the type='F', I receive a list of over 200 rows where many of the rows contain a parent_object_id, but the OBJECT_NAME(parent_object_id) is NULL.  This occurs in both databases.  Shouldn't this be impossible?  How do I go about cleaning it up?  We are currently using both SQLServer 2005 and 2008 environments.
    Wednesday, December 3, 2014 10:13 PM

Answers

All replies