Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Cascade relations


Cascade relations

Author
Message
ucbus 92278
ucbus 92278
Grasshopper
Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)

Group: General Forum Members
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
Ninja's_RGR'us
Ninja's_RGR'us
SSC-Insane
SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)

Group: General Forum Members
Points: 20941 Visits: 9671
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).
ucbus 92278
ucbus 92278
Grasshopper
Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)

Group: General Forum Members
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.
Ninja's_RGR'us
Ninja's_RGR'us
SSC-Insane
SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)

Group: General Forum Members
Points: 20941 Visits: 9671
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/
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search