Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Foreign key on two fields
Message
From
11/08/2011 12:57:48
 
General information
Forum:
Microsoft SQL Server
Category:
Other
Environment versions
SQL Server:
SQL Server 2005
Miscellaneous
Thread ID:
01520713
Message ID:
01520726
Views:
38
>Gregory,
>
>In my case the child table does have these fields (I don't know you remember an example I described in another thread). For example, the parent table (Accounts) will have fields COST_CENT (char) and SITE_NO (int)). And the child table (Purchase orders) will have the same two fields COST_CENT (char) and SITE_NO (int). If user will change the value in the COST_CENT of the parent table, all POs where this value is set should be changed. Hence the need for the constraint with cascading update.
>
>

if Accounts has (amongst other fields)

Accounts_pk
Accounts_cost_cent
Accounts_Site_no

Then, the PO table should only have an Accounts_fk, since Site_no and cost_cent can be retrieved with an sql join

If you do not store the cost center and the site_no in the PO, then you do not need a cascading update - do you ?
Gregory
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform