繁体   English   中英

定义外键时服务器错误

[英]server error while defing foreign key

> i am getting following error in sql
> server express while defining foreign
> key could any body resolve my problem
> 
> > 'tbl_branch' table saved successfully
> > 'tbl_students' table
> > - Unable to create relationship 'FK_tbl_students_tbl_branch'.  
> > Introducing FOREIGN KEY constraint
> > 'FK_tbl_students_tbl_branch' on table
> > 'tbl_students' may cause cycles or
> > multiple cascade paths. Specify ON
> > DELETE NO ACTION or ON UPDATE NO
> > ACTION, or modify other FOREIGN KEY
> > constraints. Could not create
> > constraint. See previous errors.
> > 
> > > Blockquote

我敢肯定,这是在警告您使用外键进行“圆形引用”。 即tbl_branch有一个指向tbl_students的外键,而tbl_students有一个指向tbl_branch的外键。

具体来说,问题在于您已启用级联删除或更新。 这意味着,当您删除tbl_branch中的行时,它将尝试删除tbl_students中的关联记录,这将尝试删除tbl_branch中的关联记录,等等。换句话说,您可能会导致圆柱形级联删除。

关闭级联的删除/更新,或删除“圆形”外键。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM