Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Simple design question
Message
From
21/09/2005 13:24:43
Keith Payne
Technical Marketing Solutions
Florida, United States
 
 
To
20/09/2005 09:17:02
General information
Forum:
Microsoft SQL Server
Category:
Database design
Miscellaneous
Thread ID:
01051245
Message ID:
01051715
Views:
6
V,

The data you are after is already stored in the INFORMATION_SCHEMA tables:
select 
	ccu.table_catalog + '.' + ccu.table_schema + '.' + ccu.table_name as ChildTable,
	ccu.column_name as ChildColumn,
	ctu.table_catalog + '.' + ctu.table_schema + '.' + ctu.table_name as ParentTable,
	ccu1.column_name as ParentColumn,
	ccu.constraint_name as ConstraintName,
	rc.match_option,
	rc.update_rule,
	rc.delete_rule
from information_schema.referential_constraints rc
	inner join information_schema.constraint_column_usage ccu
		on ccu.constraint_name = rc.constraint_name
	inner join information_schema.constraint_table_usage ctu
		on ctu.constraint_name = rc.unique_constraint_name
	inner join information_schema.constraint_column_usage ccu1
		on ccu1.constraint_name = ctu.constraint_name
order by
	ChildTable,
	ChildColumn,
	ParentTable,
	ParentColumn
>Hi,
>
>Anyone have done the following database design,
>
> -All the tables in a database relationship(primary & foreign key) and link are
> save in a table for fast reference.
>
>I need some reference on how to do the above mentioned design
>as my application need fast reference to which table is related to
>which table and any changes, which table will be affected. I don't
>refer to use trigger as I have lot of tables.
>
>I am designing my own but want to know from other which might
>give me a better design concept and ideas.
>
>Thank in advance.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform