How to find dependency among tables when there is no referential integrity defined among tables?
We have a database that has many tables that are populated based on the data in each other using stored procedures, functions and views. But there is no foriegn key/ referential integrity defined to tell us the dependencies. Is there a way to find out dependencies among these tables using TSQL? Regards, Manish
I would use a tool like SQL Dependency Tracker from Red Gate to find the procs/views/functions that reference the tables - from there on in it would be manual checking. And when you've finished, document it all!
Nope. The best you can do is look to see if there are common column names in use between the tables. Hopefully, whoever built this, while deviating from rock-solid common sense and best practice, used the standard method of naming the foreign key columns the same name as the primary key columns. If not, you really have nothing at all.