sql - multiple cascade paths, on update cascade -


i have problem sql server, when want have 3 table , make relationship between them, , change "on update" property "cascade".

this problem happend when want save diagram:

introducing foreign key constraint 'fk_company_slave' on table 'company' may cause cycles or multiple cascade paths. specify on delete no action or on update no action, or modify other foreign key constraints. not create constraint. see previous errors.

in picture, define data base, fk , ....

http://img.upload724.com/images/79103470449346687611.png

thanks.

first:

a foreign key in 1 table points primary key in table. if don't want use primary key on other table in order foreign key, must create unique index on table.

second:

you can create after trigger on master table in order develop on update cascade manually. in other word foreign key between company table , master table created without on update cascade , create following trigger on master update company table after changed row in master table.

create trigger triggername on dbo.[master] after insert  begin     update company     set masterkey = i.masterkey     inserted     inner join deleted d on d.code = i.code     company.masterkey = d.masterkey end 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -