Re: [問題] Cascade Delete (FK referencing colum …
※ 引述《tomex (Tomex Ou)》之銘言:
: 有人看得懂這篇的問題嗎?
: http://forums.devx.com/showthread.php?t=19241
: 回答者的意思不知在講什麼
: 就需求面上,為什麼不能同時監控兩個FK被刪除時,一起被刪呢?
: 問一些專業的dba,他們只會用sp來解決
: 但這種常態的問題,不能用個案來solve呀!
: 否則我寧願放棄fk的constraint!
Here is MS's comment on Cascading Deletes
The series of cascading referential actions triggered
by a single DELETE or UPDATE must form a tree
containing no circular references. No table can
appear more than once in the list of all cascading
referential actions that result from the DELETE or
UPDATE. The tree of cascading referential actions
must not have more than one path to any given table.
Any branch of the tree is terminated when it
encounters a table for which NO ACTION has been
specified or is the default.
所以是實作上的問題。
可惡,這實在不合理... 因為在理論上完全可行
母表改了key,就追蹤所有子表,把其欄位改值呀!
這在想法上有很難嗎?
微軟工程師不可能這樣就會放棄多個cascading的功能的
一定有怪怪處。
查了FK的Cascading鎖定資料,連續超過13小時了
看起來要放棄FK才行。
因為這是很常規的FK基本理論,假如目前資料庫系統無法提供簡易的solution
我們只好用「假關連」來得靈活。
用sp或trigger都是非正規的方式
畢竟每一個table都寫這些鬼東西,就太倚賴且與db綁太深了。
假如你的老師教你FK的理論,記得用這篇基本需求的問題問他呀!
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 220.130.1.144
討論串 (同標題文章)
以下文章回應了本文 (最舊先):
完整討論串 (本文為第 1 之 7 篇):