Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 Script Library
 SQL Schema Foreign key Relationships

Author  Topic 

Starting Member

1 Post

Posted - 2012-10-26 : 07:44:54
I have a SQL Server 2008 DB (A)with more than 400 tables where in tables have many constraints(foreign key relationships). I need to transfer a chunk of data from Database (A) to another DB (B) based upon many rules.
In order to append the data from tables in DB (A) to tables in DB (B) the data in the child table needs to be appended and then the data in the parent table needs to be appended.

Is there any tool that would generate the complete relationships of the schema starting from the base child table and cascading along.

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2012-10-26 : 10:26:36
This script finds table references and ranks them by level in order to be able to load tables with FK references in the correct order.

Find Table Reference Levels

Go to Top of Page

Starting Member

6 Posts

Posted - 2012-11-20 : 22:40:33
Thank you for this article. That’s all I can say. You most definitely have made this blog into something special. You clearly know what you are doing, you’ve covered so many bases.Thanks!

xingchen chen123
Go to Top of Page

- Advertisement -