Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Cascade relations Expand / Collapse
Author
Message
Posted Monday, January 17, 2011 11:34 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Tuesday, March 15, 2011 3:36 PM
Points: 24, Visits: 119
I have a database with 100+ tabes. I am tasked to find out the cascade relations amongst the tables, so that we could delete the records of the database easily using cascade delete. My question is : Is there any script that gives the relations of the tables in a readable format. I see one way is to create the DB diagram and study for each relation. However I am looking for something that generates the report like format so that it can be compared to the same DB in another environment.

Please let me know
Post #1048885
Posted Monday, January 17, 2011 11:43 AM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Tuesday, August 19, 2014 2:45 AM
Points: 21,397, Visits: 9,610
The only thing I ever saw was a "best guess" script. It was matching the tables by finding columns with the same name and IIRC data types.


Now that will only work if the schema is perfectly named based on a business rule. However since the FKs are not created then you'll most likely find that you are out of luck in the department.


What I'd do is start a trace and read the object definitions of all the views / table functions and sps, etc.

Pick out the joins one at a time and start scripting the fks in a test db.

Any way you approach this, this is a monumental task for a system with 100 tables. Better set aside a few weeks to do this (I've never done that without having to clean the data, ddl design and code, hence MONUMENTAL task).
Post #1048886
Posted Monday, January 17, 2011 11:46 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Tuesday, March 15, 2011 3:36 PM
Points: 24, Visits: 119
Thanks.
Any one has a script. Thinking of something that will read the object definitions and map the relations. Please let me know.
Post #1048889
Posted Monday, January 17, 2011 11:50 AM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Tuesday, August 19, 2014 2:45 AM
Points: 21,397, Visits: 9,610
That was doing a good job in 2003. I have not tried it since so maybe it can help you out.

There's a free trial so you should have enough time to check it out before having to buy :

http://www.red-gate.com/products/sql-development/sql-dependency-tracker/
Post #1048892
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse